Wednesday 28 August 2019

worksheet function - Check if Excel cell text is numeric using formula only


I have to find out if my cells text is a numeric value and wanted to use an elegant non VBA method that doesn't impede on its current state or value.


What I've found is that the ISNUMBER() function only works if the cells are number formatting or has no spaces if text formatting e.g.:


number as text examples


For the first three I've used =ISNUMBER(...) and my last attempt is =ISNUMBER(TRIM(...)).


The only method I've used that doesn't use VBA is to override my current values using text to columns then use the =ISNUMBER() function.


Note: I am proficient with VBA and Excel and understand I could create a user-defined function. But I don't want to as this imposes a macro required workbook or an add-in to be installed, which I can and have done in some cases.


I will appreciate any advice, thoughts (even if they tell me it can't be done) or VBA solutions (won’t be marked as answer however).



Answer



Try multiplying the cell value by 1, and then running the IsNumber and Trim functions, e.g.,:


=IsNumber(Trim(A1)*1)


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...