Search code examples
excelworksheet-functionarray-formulas

Have formula treat value as text, not numeric


I have an Excel formula reading data from a column. The data in that column is sometimes a date-like format, such as "10-11". Despite the fact that I've ensured that column is text formatted -- and all values display correctly as plain text, not reinterpreted as dates -- the formula is basically reinterpreting them as dates in the reference.

I need a way to force the formula's cell reference to interpret the cell as text. I tried TEXT(A1, "@") but it doesn't work -- it gives the numeric value of the date.


Solution

  • Brian Camire's answer explains why, but here's a worksheet function that will work for you. Note that you have to create that numeric array in it based on how long the longest string will be. It's an array formula, so when you first enter it you have to hit CTRL-SHIFT-ENTER, then you can click and drag it down the column.

    =LEFT(A1, MATCH(FALSE, ISNUMBER(VALUE(MID(A1, {1,2,3,4,5}, 1))),0) - 1)