# SolvedCant get this if to work... (1 Viewer)

#### Number11

##### Member
I need to group the dates as follows...

Number < week old
Number >1 week but < 1 month old
Number >1 month but < 3 months old
Number >3 months but < 6 months old
Number > 6 months

=IF(AR6<7,"< 1 Week",IF(AR6<30,">1 week & < 1 month old",IF(AR6<31,">1 Month & < 3month old",IF(AR6<90,"> 3month old & < 6 Months",IF(AR6<182,"> 3month old & > 6 Months)))))))

Not working ?

#### MajP

##### You've got your good things, and you've got mine.
See my post in this thread how to do this

You would build the same table

#### Number11

##### Member
See my post in this thread how to do this

You would build the same table
Thanks i need to have this formula with excel not a database

#### MajP

##### You've got your good things, and you've got mine.
Sorry. Did not notice what forum it was in, but I would assume that is a perfect Vlookup, but I am not an Excel expert.

#### Number11

##### Member
Sorry. Did not notice what forum it was in, but I would assume that is a perfect Vlookup, but I am not an Excel expert.
No worries thanks anyway

#### Number11

##### Member
think i have this working now...

=IF(AR5<7,"< 1 Week",IF(AR5<30,">1 week & < 1 month old",IF(AR5<90,">1 Month & < 3month old",IF(AR5<182,"> 3month old & < 6 Months",IF(AR5>182,"> 6 Months pls")))))

Last edited:

#### Darrell

##### Registered User.
Except if your number is 182. You may want to add an = to the last condition.

IF(AR5>=182,"> 6 Months pls")))))

#### arnelgp

without using IF():

=SWITCH(TRUE, AR5<7,"< 1 Week",AR5<30,">1 week & < 1 month old",AR5<90,">1 Month & < 3month old",AR5<182,"> 3month old & < 6 Months",AR5>=182,"> 6 Months pls")

#### MajP

##### You've got your good things, and you've got mine.
I am no Excel expert, but this is a basic vlookup IMO. Those functions are overly complicated and not flexible.

#### Isaac

##### Lifelong Learner
Sometimes when IF statements get hard to look at it's a nice option to create a small reference table/range and just vlookup to it.

Replies
6
Views
60
Replies
3
Views
53
Replies
7
Views
180
Replies
3
Views
152
Replies
3
Views
227