Преобразование юникода в соответствующий текст в электронной таблице Excel

42855
NealWalters

Я использую "Char", чтобы преобразовать число ASCII в символ. Что я использую для преобразования номера Unicode в символ?

Я строю график конверсии иврита. Например, 1489 - это буква «СТАВКА». У меня есть 1489 в столбце A, и я хочу показать ставку в столбце B.

6

2 ответа на вопрос

2
stema

Я думаю, что вы должны сделать свою собственную функцию, VBA имеет функцию для получения символа из кода, но я не знаю функцию листа. Итак, просто поместите в модуль вашего файла Excel эту функцию:

Function Unicode(val As Long) Unicode = ChrW(val) End Function 

И тогда вы можете вызвать это с вашего рабочего листа, используя =Unicode(A1)

Result of the user defined function

Если в вашем Excel есть шрифт, который может отображать ваш персонаж, вы увидите его.

(если ваши числа в шестнадцатеричном формате):

Function Unicode(val As String) Unicode = ChrW("&H" & val) End Function 
** Курьер Новый ** или ** Arial Unicode MS ** должен работать. Ellesa 12 лет назад 0
2
TehMacDawg

I ran into this little problem today, so here's an update:

Excel 2013 introduced the function UNICHAR() which returns the character of the Unicode value given in decimal notation. The function UNICODE() works the other way around, returning a character's Unicode value. This is not available in earlier Excel versions, including Office for Mac 2011.

The exact same functions are however available in the current version of the open-source software LibreOffice Calc (and OpenOffice Calc, I suppose).

E.g., you have a long column 'A' with hexadecimal Unicode values (without the “U+”) and want the characters in column 'B'. Since UNICHAR needs decimal values, combine it with the conversion function HEX2DEC() in the formula. So, in cell B1 put in the formula:

=UNICHAR (HEX2DEC ($A1)) 

Or, if the values are already in decimal format:

=UNICHAR ($A1) 

To apply the formula to all cells below B1, double-click the little handle on the lower left corner of the highlighted cell frame (works in Calc and Excel). Format the column with a font that covers as many Unicode glyphs as possible, e.g., MS Arial Unicode (not the 'normal' Arial). That's it.

(A problem might occur, where the cells display the formula itself instead of the results. In this case the column needs to be formatted to the content type 'text' or 'general'. )

PS:

In Apple Numbers ’09, CHAR () does work with Unicode values. The formula is:

=CHAR (HEX2DEC(A)) 

or

=CHAR (A) 

Похожие вопросы