UTF 8 byte length of a string in microsoft excel
<p>I am trying to add in cell data validation for a string length to be between 8 and 16 and the max byte length less than 40(UTF8 encoding).<br></p>

<p>I created a data validation using the excel active support:<br>
<em>Data validation(data tab -> Data Validation (between Remove Duplicates and Consolidate in excel 2016 mac)), In Settings tab</em>, there is validation </p>

<pre><code>criteria:
Validation Criteria:
Allow: Text Length
Data : between
Min : 8 &amp; Max : 16
</code></pre>

<p>Though the above validation satisfies all the restrictions i have(8

<p>For other languages(say Japanese), though the string length is being counted though physical length(Eg : <code>"こんにちはこんにちはこんにちは"</code>, hellohellohello in Japanese), the UTF8 byte value is 45 bytes, which is the violation of the 40 bytes, thought the length is only 15.</p>

<p>I found "LENB" function in excel, but it is giving the value as 30(instead of 45). I think it is based on different encoding(ansi maybe)</p>

<p>I found the UNICODE function which gives the unicode number of the first character(12371) in the above case. But i don't see how can i get the byte value from this number(3 bytes is the value for the first character(こ)).</p>

<p>Any help in this regard will be greatly appreciated.</p>