ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Can i run 2 IF statements in one formula? (https://www.excelbanter.com/excel-worksheet-functions/218939-can-i-run-2-if-statements-one-formula.html)

Zak

Can i run 2 IF statements in one formula?
 
I have a column which can contain only numbers and can only be up to 4 digits
long. Is there an IF statement I can write to check for these 2 conditions?

Thanks in advance

Pete_UK

Can i run 2 IF statements in one formula?
 
Something like this:

=IF(AND(ISNUMBER(A1),LEN(A1)<=4),"okay","wrong")

Copy down as required.

Hope this helps.

Pete

On Feb 3, 4:12*pm, zak wrote:
I have a column which can contain only numbers and can only be up to 4 digits
long. *Is there an IF statement I can write to check for these 2 conditions?

Thanks in advance



John Bundy

Can i run 2 IF statements in one formula?
 
you can, yes, but you might like validation better. Go to Data-Validation
and choose Custom, enter this formula substituting A1 as necessary
=AND(LEN(A1)=4,ISNUMBER(A1)=TRUE)
You can also have an input message telling them what is required and a
custom error message that tells them the rules.

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"zak" wrote:

I have a column which can contain only numbers and can only be up to 4 digits
long. Is there an IF statement I can write to check for these 2 conditions?

Thanks in advance


David Biddulph[_2_]

Can i run 2 IF statements in one formula?
 
You can omit the =TRUE
And you probably need <=4, rather than =4
--
David Biddulph

"John Bundy" (remove) wrote in message
...
you can, yes, but you might like validation better. Go to Data-Validation
and choose Custom, enter this formula substituting A1 as necessary
=AND(LEN(A1)=4,ISNUMBER(A1)=TRUE)
You can also have an input message telling them what is required and a
custom error message that tells them the rules.

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"zak" wrote:

I have a column which can contain only numbers and can only be up to 4
digits
long. Is there an IF statement I can write to check for these 2
conditions?

Thanks in advance





All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com