Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Todd F.
 
Posts: n/a
Default 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   Report Post  
bj
 
Posts: n/a
Default

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   Report Post  
garfield-n-odie
 
Posts: n/a
Default

=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   Report Post  
Todd F.
 
Posts: n/a
Default

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   Report Post  
Todd F.
 
Posts: n/a
Default

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   Report Post  
Niek Otten
 
Posts: n/a
Default

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   Report Post  
Bill Kuunders
 
Posts: n/a
Default

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   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

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   Report Post  
bj
 
Posts: n/a
Default

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   Report Post  
Todd F.
 
Posts: n/a
Default

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   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

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   Report Post  
Todd F.
 
Posts: n/a
Default

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   Report Post  
Todd F.
 
Posts: n/a
Default

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   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Working time and days Nortos Excel Worksheet Functions 5 May 6th 05 04:17 PM
Working time and days Nortos Excel Discussion (Misc queries) 1 May 6th 05 03:47 PM
Trace Dependents and Precedents not working Manish Excel Worksheet Functions 0 April 11th 05 09:39 PM
Nested IF statements John Simons Excel Worksheet Functions 14 February 16th 05 06:17 AM
7+ nested if statement? Turi Excel Worksheet Functions 3 December 20th 04 07:55 PM


All times are GMT +1. The time now is 11:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"