Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Nested IF(AND is not working
I searched & searched for an old post to cover this but nothing out there.
I have the following formula that is got an error in it: =IF(I2<30, "< 30"), IF(AND(I2=30, I2<=60),"31-60"), IF(AND(I260, I2<=90),"61-90"), IF(I2=91, " 91") my goal is tot have the following for statements placed in a cell via this calculation to cover 4 possible variables. if number is then or equal to 30 then tag "<30" if number is 31 or greater and 60 or less then tag "31-60" if number is greater then 60 but less then or equal to 90 then tag "61-90" if number is greater then or equal to 91 then tag "91+" I use to do these all the time what is up with this formula: Thanks Todd Frisch |
#2
|
|||
|
|||
The only thing I see wrong is that you need 3 more parenthsis at the end of
the equation, You could make it simpler =if(I2<30,"<30,if(I290,"90",if(I260,"61-90","30-60"))) "Todd F." wrote: I searched & searched for an old post to cover this but nothing out there. I have the following formula that is got an error in it: =IF(I2<30, "< 30"), IF(AND(I2=30, I2<=60),"31-60"), IF(AND(I260, I2<=90),"61-90"), IF(I2=91, " 91") my goal is tot have the following for statements placed in a cell via this calculation to cover 4 possible variables. if number is then or equal to 30 then tag "<30" if number is 31 or greater and 60 or less then tag "31-60" if number is greater then 60 but less then or equal to 90 then tag "61-90" if number is greater then or equal to 91 then tag "91+" I use to do these all the time what is up with this formula: Thanks Todd Frisch |
#3
|
|||
|
|||
=IF(I2="","",IF(I2<30,"<30",IF(I2<60,"31-60",IF(I2<90,"61-90","91+")))
Todd F. wrote: I searched & searched for an old post to cover this but nothing out there. I have the following formula that is got an error in it: =IF(I2<30, "< 30"), IF(AND(I2=30, I2<=60),"31-60"), IF(AND(I260, I2<=90),"61-90"), IF(I2=91, " 91") my goal is tot have the following for statements placed in a cell via this calculation to cover 4 possible variables. if number is then or equal to 30 then tag "<30" if number is 31 or greater and 60 or less then tag "31-60" if number is greater then 60 but less then or equal to 90 then tag "61-90" if number is greater then or equal to 91 then tag "91+" I use to do these all the time what is up with this formula: Thanks Todd Frisch |
#4
|
|||
|
|||
I did the parenthisis and tried several combinations - the darn thing will
not work. Any thoughts on my formula and thanks for your formula but I would like to solve my issue "Todd F." wrote: I searched & searched for an old post to cover this but nothing out there. I have the following formula that is got an error in it: =IF(I2<30, "< 30"), IF(AND(I2=30, I2<=60),"31-60"), IF(AND(I260, I2<=90),"61-90"), IF(I2=91, " 91") my goal is tot have the following for statements placed in a cell via this calculation to cover 4 possible variables. if number is then or equal to 30 then tag "<30" if number is 31 or greater and 60 or less then tag "31-60" if number is greater then 60 but less then or equal to 90 then tag "61-90" if number is greater then or equal to 91 then tag "91+" I use to do these all the time what is up with this formula: Thanks Todd Frisch |
#5
|
|||
|
|||
i will lok at it tonight I pasted it in but formula is visibl ein cell and
will not calculate why o why "bj" wrote: The only thing I see wrong is that you need 3 more parenthsis at the end of the equation, You could make it simpler =if(I2<30,"<30,if(I290,"90",if(I260,"61-90","30-60"))) "Todd F." wrote: I searched & searched for an old post to cover this but nothing out there. I have the following formula that is got an error in it: =IF(I2<30, "< 30"), IF(AND(I2=30, I2<=60),"31-60"), IF(AND(I260, I2<=90),"61-90"), IF(I2=91, " 91") my goal is tot have the following for statements placed in a cell via this calculation to cover 4 possible variables. if number is then or equal to 30 then tag "<30" if number is 31 or greater and 60 or less then tag "31-60" if number is greater then 60 but less then or equal to 90 then tag "61-90" if number is greater then or equal to 91 then tag "91+" I use to do these all the time what is up with this formula: Thanks Todd Frisch |
#6
|
|||
|
|||
Come on, Todd,
There are spaces in your formula, the brackets don't pair, you put brackets where they shouldn't be, you surely did better in the past. Try =IF(I2<30,"< 30",IF(AND(I2=30,I2<=60),"31-60",IF(AND(I260,I2<=90),"61-90",IF(I2=91," 91")))) -- Kind regards, Niek Otten Microsoft MVP - Excel "Todd F." wrote in message ... I searched & searched for an old post to cover this but nothing out there. I have the following formula that is got an error in it: =IF(I2<30, "< 30"), IF(AND(I2=30, I2<=60),"31-60"), IF(AND(I260, I2<=90),"61-90"), IF(I2=91, " 91") my goal is tot have the following for statements placed in a cell via this calculation to cover 4 possible variables. if number is then or equal to 30 then tag "<30" if number is 31 or greater and 60 or less then tag "31-60" if number is greater then 60 but less then or equal to 90 then tag "61-90" if number is greater then or equal to 91 then tag "91+" I use to do these all the time what is up with this formula: Thanks Todd Frisch |
#7
|
|||
|
|||
A few too many brackets
=IF(I2<30, "<30", IF(AND(I2=30, I2<=60),"31-60", IF(AND(I260,I2<=90),"61-90", IF(I2=91, " 91")))) This will work You can simplify.........no need for the AND functions =IF(I2<30, "< 30", IF(I2<=60,"31-60", IF(I2<=90,"61-90", " 91"))) You may want to change the class "<30" to "<=30" if you have the next class from 31 to 60. And show the last as "90" =IF(I2<=30, "<= 30", IF(I2<=60,"31-60", IF(I2<=90,"61-90", " 90"))) -- Greetings from New Zealand Bill K "Todd F." wrote in message ... I searched & searched for an old post to cover this but nothing out there. I have the following formula that is got an error in it: =IF(I2<30, "< 30"), IF(AND(I2=30, I2<=60),"31-60"), IF(AND(I260, I2<=90),"61-90"), IF(I2=91, " 91") my goal is tot have the following for statements placed in a cell via this calculation to cover 4 possible variables. if number is then or equal to 30 then tag "<30" if number is 31 or greater and 60 or less then tag "31-60" if number is greater then 60 but less then or equal to 90 then tag "61-90" if number is greater then or equal to 91 then tag "91+" I use to do these all the time what is up with this formula: Thanks Todd Frisch |
#8
|
|||
|
|||
On Thu, 23 Jun 2005 13:20:02 -0700, "Todd F."
wrote: I searched & searched for an old post to cover this but nothing out there. I have the following formula that is got an error in it: =IF(I2<30, "< 30"), IF(AND(I2=30, I2<=60),"31-60"), IF(AND(I260, I2<=90),"61-90"), IF(I2=91, " 91") my goal is tot have the following for statements placed in a cell via this calculation to cover 4 possible variables. if number is then or equal to 30 then tag "<30" if number is 31 or greater and 60 or less then tag "31-60" if number is greater then 60 but less then or equal to 90 then tag "61-90" if number is greater then or equal to 91 then tag "91+" I use to do these all the time what is up with this formula: Thanks Todd Frisch Try: =VLOOKUP(A2,{0,"<30";31,"31-60";61,"61-90";91,"91+"},2) --ron |
#9
|
|||
|
|||
a lot of times when you paste a formula into a cell it initially thinks it is
text. I often just click in front of the "=" hit delete and enter. other times I have to reformat the cell as general. "Todd F." wrote: i will lok at it tonight I pasted it in but formula is visibl ein cell and will not calculate why o why "bj" wrote: The only thing I see wrong is that you need 3 more parenthsis at the end of the equation, You could make it simpler =if(I2<30,"<30,if(I290,"90",if(I260,"61-90","30-60"))) "Todd F." wrote: I searched & searched for an old post to cover this but nothing out there. I have the following formula that is got an error in it: =IF(I2<30, "< 30"), IF(AND(I2=30, I2<=60),"31-60"), IF(AND(I260, I2<=90),"61-90"), IF(I2=91, " 91") my goal is tot have the following for statements placed in a cell via this calculation to cover 4 possible variables. if number is then or equal to 30 then tag "<30" if number is 31 or greater and 60 or less then tag "31-60" if number is greater then 60 but less then or equal to 90 then tag "61-90" if number is greater then or equal to 91 then tag "91+" I use to do these all the time what is up with this formula: Thanks Todd Frisch |
#10
|
|||
|
|||
this is a very interesting formula , never thought of using vlookup which I
am a big fan of . do you feel like explaining this to me or directing me to a place to read about this. thanks for the time "Ron Rosenfeld" wrote: On Thu, 23 Jun 2005 13:20:02 -0700, "Todd F." wrote: I searched & searched for an old post to cover this but nothing out there. I have the following formula that is got an error in it: =IF(I2<30, "< 30"), IF(AND(I2=30, I2<=60),"31-60"), IF(AND(I260, I2<=90),"61-90"), IF(I2=91, " 91") my goal is tot have the following for statements placed in a cell via this calculation to cover 4 possible variables. if number is then or equal to 30 then tag "<30" if number is 31 or greater and 60 or less then tag "31-60" if number is greater then 60 but less then or equal to 90 then tag "61-90" if number is greater then or equal to 91 then tag "91+" I use to do these all the time what is up with this formula: Thanks Todd Frisch Try: =VLOOKUP(A2,{0,"<30";31,"31-60";61,"61-90";91,"91+"},2) --ron |
#11
|
|||
|
|||
On Fri, 24 Jun 2005 05:33:04 -0700, "Todd F."
wrote: this is a very interesting formula , never thought of using vlookup which I am a big fan of . do you feel like explaining this to me or directing me to a place to read about this. thanks for the time "Ron Rosenfeld" wrote: Try: =VLOOKUP(A2,{0,"<30";31,"31-60";61,"61-90";91,"91+"},2) --ron Look at HELP for VLOOKUP. The part of the formula above that is within the braces is what is called an array constant. Commas separate columns and semicolons separate rows. So A2 is your lookup_value. Your lookup_array could also be a range reference looking like: 0 <30 31 31-60 61 61-90 91 91+ In, let us say, L1:M4. The "2" at the end of the formula says to find the match in column 2. So the formula looks for some value (A2) in the leftmost column of the table that is either an exact match or, if an exact match is not found, the next largest value that is less than lookup_value. Since, for example, there is no exact match for '15', the largest value in the table that is less than 15 is '0'; in column 2 of that row is the "<30" so that's what gets returned. Lookup tables are frequently much more flexible, and easier to modify, than complicated IF statements. If you set up a table as above some place, instead of using the array constant, the formula could be rewritten as: =VLOOKUP(A2,tbl,2) or =VLOOKUP(A2,L1:M4,2) --ron |
#12
|
|||
|
|||
thanks you much I will study this in next few days and I hope to make use of it
"Ron Rosenfeld" wrote: On Fri, 24 Jun 2005 05:33:04 -0700, "Todd F." wrote: this is a very interesting formula , never thought of using vlookup which I am a big fan of . do you feel like explaining this to me or directing me to a place to read about this. thanks for the time "Ron Rosenfeld" wrote: Try: =VLOOKUP(A2,{0,"<30";31,"31-60";61,"61-90";91,"91+"},2) --ron Look at HELP for VLOOKUP. The part of the formula above that is within the braces is what is called an array constant. Commas separate columns and semicolons separate rows. So A2 is your lookup_value. Your lookup_array could also be a range reference looking like: 0 <30 31 31-60 61 61-90 91 91+ In, let us say, L1:M4. The "2" at the end of the formula says to find the match in column 2. So the formula looks for some value (A2) in the leftmost column of the table that is either an exact match or, if an exact match is not found, the next largest value that is less than lookup_value. Since, for example, there is no exact match for '15', the largest value in the table that is less than 15 is '0'; in column 2 of that row is the "<30" so that's what gets returned. Lookup tables are frequently much more flexible, and easier to modify, than complicated IF statements. If you set up a table as above some place, instead of using the array constant, the formula could be rewritten as: =VLOOKUP(A2,tbl,2) or =VLOOKUP(A2,L1:M4,2) --ron |
#13
|
|||
|
|||
how very true I have bene away from vba so long I am ashamed of my current
skills also very sorry to see access to my old posts seems to have dried up. I appreciate your effort - your repost worked I think with this curren tjob i will have ample opportunity to get serious about vba once and for all. "Niek Otten" wrote: Come on, Todd, There are spaces in your formula, the brackets don't pair, you put brackets where they shouldn't be, you surely did better in the past. Try =IF(I2<30,"< 30",IF(AND(I2=30,I2<=60),"31-60",IF(AND(I260,I2<=90),"61-90",IF(I2=91," 91")))) -- Kind regards, Niek Otten Microsoft MVP - Excel "Todd F." wrote in message ... I searched & searched for an old post to cover this but nothing out there. I have the following formula that is got an error in it: =IF(I2<30, "< 30"), IF(AND(I2=30, I2<=60),"31-60"), IF(AND(I260, I2<=90),"61-90"), IF(I2=91, " 91") my goal is tot have the following for statements placed in a cell via this calculation to cover 4 possible variables. if number is then or equal to 30 then tag "<30" if number is 31 or greater and 60 or less then tag "31-60" if number is greater then 60 but less then or equal to 90 then tag "61-90" if number is greater then or equal to 91 then tag "91+" I use to do these all the time what is up with this formula: Thanks Todd Frisch |
#14
|
|||
|
|||
On Fri, 24 Jun 2005 13:05:02 -0700, "Todd F."
wrote: thanks you much I will study this in next few days and I hope to make use of it You're welcome. Post back if any problems. --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Working time and days | Excel Worksheet Functions | |||
Working time and days | Excel Discussion (Misc queries) | |||
Trace Dependents and Precedents not working | Excel Worksheet Functions | |||
Nested IF statements | Excel Worksheet Functions | |||
7+ nested if statement? | Excel Worksheet Functions |