IF statement determining day is greater then or less then a date

olivia.ruiz82

New Member
Joined
Feb 21, 2011
Messages
4
Help determining if a date or number of days is greater then or less then a date.

Computer System: Excel 2007, Windows XP
In Cell A2, list of dates i.e. 12/30/2010

I would like to create a formula (IF statement maybe?) to see if the date in A2 is less then 14 days, then return "3", if false then check to see if the date in A2 is greater than "15" days, but less than "28" days, then return "4", if false, then check to see if A2 is equal to "29", "30", "31", if true then return "5".

I have come up with "=IF(U3<="14","3",IF(U3>="15"<="28","4",IF(U3=29,"5",IF(U3=30,"5",IF(U3=31,"5")))))" but this returns "3" when A2 is 12/30/2010.

I also tried using the DAY function to covert the date to number of days, which looks like "=IF(DAY(U2)<="14","3",IF(DAY(U2)>="15"<="28","4",IF(DAY(U2)="29","5",IF(DAY(U2)="30","5",IF(DAY(U2)="31","5")))))"
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Thank you so much. I never thought about the lookup function. I really appreciate your help. I guess I was thinking too hard....

I modified the formula to =LOOKUP(DAY(U5),{0,15,28},{3,4,5})
I was getting an error "#N/A" for previous dates I was trying to evaluate for, so I changed it and got the result I needed.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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