If nested formula - all same result

toony

Board Regular
Joined
Mar 20, 2014
Messages
91
Office Version
  1. 365
Hi. I am grouping ages using the below formula but all gives "Adult" if you can help me please. I've tried to change the > and < symbols but to me the below makes sense and don't really know what i'm doing wrong if you can help please.
=IF([@Age]>=18,"Adult",IF([@Age]>=40,"Mature","Senior"))
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi Toony,

It find greater than 18, sets "Adult" and ends execution. You don't cater for aged less than 18 or define when a Senior age starts, so I've added more checks.

Toony.xlsx
ABC
1NameAgeResult
2Bob44Mature
3Sue66Senior
4Jim33Adult
5Kim18Adult
6Olive17Youngster
7Vera5Youngster
Sheet1
Cell Formulas
RangeFormula
C2:C7C2=IF([@Age]>=65,"Senior",IF([@Age]>=40,"Mature",IF([@Age]>=18,"Adult","Youngster")))
Named Ranges
NameRefers ToCells
Age=Sheet1!$B$2:$B$7C2
 
Upvote 0
That's perfect it works as it should. I knew it was something to do with what you mentioned of not setting the ages right. I was looking forward to the explanation itself rather than the solution to it. I love the explanation and have taken a good note of it. Cheers
 
Upvote 0
That's perfect it works as it should. I knew it was something to do with what you mentioned of not setting the ages right. I was looking forward to the explanation itself rather than the solution to it. I love the explanation and have taken a good note of it. Cheers
You're welcome.
 
Upvote 0
=LOOKUP([Age],{0,18,40,65},{"Youngster","Adult","Mature","Senior"})
I like it actually but haven't dealt much with array formulas and can't make it work sorry.
I've presss Shif+Control+Enter but I don't think that am doing it right. So I ended entering the curl brackets manually...but obvioiusly didn't work either.
If you can help with it please, though not easy to explain it unless seeing it I guess

=lookup([@Age],(0,18,40,65),{"Youngster","Adult","Mature","Senior"})
 
Upvote 0
It is a regular formula, you should not enter it as an array formula.

Maybe you need the @, then
Excel Formula:
=LOOKUP([@Age],{0,18,40,65},{"Youngster","Adult","Mature","Senior"})

Or maybe you need the separated semicolon:
Excel Formula:
=LOOKUP([Age],{0;18;40;65},{"Youngster";"Adult";"Mature";"Senior"})

Or this:
Excel Formula:
=LOOKUP([@Age],{0;18;40;65},{"Youngster";"Adult";"Mature";"Senior"})
 
Upvote 0
It is a regular formula, you should not enter it as an array formula.

Maybe you need the @, then
Excel Formula:
=LOOKUP([@Age],{0,18,40,65},{"Youngster","Adult","Mature","Senior"})

Or maybe you need the separated semicolon:
Excel Formula:
=LOOKUP([Age],{0;18;40;65},{"Youngster";"Adult";"Mature";"Senior"})

Or this:
Excel Formula:
=LOOKUP([@Age],{0;18;40;65},{"Youngster";"Adult";"Mature";"Senior"})
Do you press control+shift+enter for the curl brackets or manually entered?
 
Upvote 0
Manually.
In this case, they are used for a data array.
But it is not a formula array.
 
Upvote 0
Do you press control+shift+enter for the curl brackets or manually entered?
Thanks it works perfect too. I put the semicolon just after I sent you the reply and put the curl bracket manually again and it's fine. I must have missed one thing or another. Cheers :)
 
Upvote 0

Forum statistics

Threads
1,215,139
Messages
6,123,259
Members
449,093
Latest member
Vincent Khandagale

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top