Converting a Number to Text:
This is a very simple tip, but it may be useful to some nonetheless...
- If you need to convert a number to text from within a formula, use the concatenation operator to join two parts of the number as a string (i.e.
1&23
).
- If you need to convert a number to text for use by cell reference (i.e.
A1
), change the Number Format of the cell to Text to eliminate the need for extra bytes.
- See the chart below for a comparison of number-to-text methods.
Quick Reference Chart:
+-------------------------------------------------------------------------------------+
| | A | B | C | D | E |
|-------------------------------------------------------------------------------------|
| 1 | Formula | Bytes | Result | ISTEXT(cell)¹ | ISTEXT(formula)² |
|-------------------------------------------------------------------------------------|
| 2 | =TEXT(123,0) | 12 | 123 | TRUE | TRUE |
| 3 | ="123" | 6 | 123 | TRUE | TRUE |
| 4 | =1&23 | 5 | 123 | TRUE | TRUE |
| 5 | '123 | 4 | 123 | TRUE | NOT VALID |
| 6 | 123 | 3 | 123 | TRUE | FALSE |
| 7 | 123 | 3 | 123 | FALSE | FALSE |
+-------------------------------------------------------------------------------------+
Note: The result for cell C6 has been formatted as text, whereas the result for C7 has not.
¹ Denotes =ISTEXT(C2), =ISTEXT(C3), =ISTEXT(C4), etc.
² Denotes =ISTEXT(TEXT(123,0)), =ISTEXT("123"), =ISTEXT(1&23), etc.
4apparently [tag:cellular-automata] isn't something that is related to excel... :( – None – 2016-09-20T18:46:45.293
I was wondering if is it valid to create an UDF with VBA? – danieltakeshi – 2017-10-16T13:42:10.853
1@danieltakeshi - no; well, not as an Excel answer - if you instead use Excel VBA and then call it from the immediate window, the activesheet or a subroutine, that it generally regarded as valid – Taylor Scott – 2017-12-18T20:29:48.843