Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Is it possible to test for integers or strings in a Google Spreadsheet and respond to each differently?

share|improve this question

migrated from superuser.com Feb 22 '11 at 11:08

This question came from our site for computer enthusiasts and power users.

    
Did you find any of the answers given useful? –  Jacob Jan Tuinstra Mar 13 at 11:07
add comment

2 Answers 2

up vote 5 down vote accepted

To test for string you can use =ISTEXT(A1)

To test for an Integer you will need to do something like this:

=IF( (D8 = int(D8)), TRUE, FALSE)

Which basically converts the value to an Integer and then checks if it is the same as the original pre-converted value.

share|improve this answer
    
I think =D8=int(D8) will do. (not tested) –  wilson Feb 23 '11 at 8:23
    
@Wilson - Yes you are correct :) –  Barry Feb 23 '11 at 9:07
add comment

You should be able to use the following function:

=ISNUMBER(B1)

Which returns either TRUE or FALSE.

share|improve this answer
1  
IsNumberwill return true for any number regardless of whether it is an int or a decimal e.g. 10 and 10.56 will both return true. –  Barry Feb 22 '11 at 11:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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