IIF Statment (Days Aged)

gpouliot

New Member
Joined
Jan 19, 2009
Messages
39
Hi,

I'm currently using DateDiff("d",[Tran_Date],Now()). What I'm trying to do now is create a category called "Days Aged Cat"

1-7 Days
7-14 Days
14-30 Days
30+ Days

I know I can use the IIF statement and I was able to to do the first one
IIF([Days]<=7,"1-7Days") but this is as far as I got. I'm not sure how to create the remainder of the string. I always get an error.

Thanks
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
67,077
Office Version
  1. 365
Platform
  1. Windows
Just keep nesting your IIF statements.

But you first need to determine some definite end-points. If it is 7 days, where does it fall? In "1-7 days" or "7-14 days"?

Your final statement will look something like:

Code:
IIF([Days]<=7,"1-7 Days",IIF([Days]<=14,"8-14 Days",IIF([Days]<=30,"15-30 Days","30+ Days")))
 
Upvote 0

Forum statistics

Threads
1,191,499
Messages
5,986,920
Members
440,065
Latest member
JCH136

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
Top