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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,214,821
Messages
6,121,762
Members
449,048
Latest member
excelknuckles

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