0

I would like to know if a cell is a date, a number, a string or what. It would help a lot, exactly what/how should be done with it.

I think, librecalc knows it, because it affects the behavior of the cells on many ways (for example, date fields are converted by the actually used date format). But I did not find anything, how could I extract this important info.

2 Answers 2

1

You should use the TYPE function which:

TYPE Returns the type of value, where 1 = number, 2 = text, 4 = Boolean value, 8 = formula, 16 = error value, 64 = array.

If an error occurs, the function returns a logical or numerical value.

Dates are stored as numbers, so a date returns the value of 1.

1
  • Thanks, that is nice! However, there is still a difference between "24576" and a date "1994-03-05", even if its backend representation is the same. I think your answer could be made much more helpful if there would be some way to know even that.
    – peterh
    Jan 14 at 15:30
1

An alternative to a bunch of other functions is available in CELL(...)

Now: =CELL("FORMAT",A1) or even =CELL("TYPE",A1)
... seems as an alternative to =TYPE(...)
Still with some idiosyncrasy though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.