If Formula is not giving me results i am looking for.

melaniemcisaac

New Member
Joined
Dec 14, 2018
Messages
3
I want to assign a week number to correlate with a range of dates.

If the date in cell A5 is between 01/01/2019 and 01/05/2019 I want it to say "1"
If the date in cell A5 is between 01/06/2019 and 01/12/2019 I want it to say "2"
If the date in cell A5 is between 01/13/2019 and 01/19/2019 I want it to say "3"
If the date in cell A5 is between 01/20/2019 and 01/25/2019 I want it to say "4"

If it does not meet any of these, I want it to be blank.

This is the formula I have and it is not giving me what I want

=IF(A5>=1/1/2019<=1/5/2019,"1",IF(A5>=1/6/2019<=1/12/2019,"2",IF(A5>=1/13/2019<=1/19/2019,"3",IF(A5>=1/20/2019<=1/26/2019,"4",""))))
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I wrote a formula like this recently for someone else on MrExcel. My guess is that Excel doesn't accept the syntax in your logical test.<y"<y." use="" and="" instead.
<y"


=IF(AND(A5>=1/1/2019,A5<=1/5/2019),"1",IF(AND(...

And then IFERROR around it to cover values outside the first and last dates, and make the value if error blank.</y"
</y"<y.">
 
Last edited:
Upvote 0
Maybe like
=IF(A5< DATEVALUE("1/1/2019"),0,IF(A5< DATEVALUE("1/6/2019"),1,IF(A5< DATEVALUE("1/12/2019"),2)))
 
Last edited:
Upvote 0
Another way
=IFERROR(LOOKUP(A5,DATEVALUE({"1/1/2019","1/6/2019","1/13/2019","1/20/2019","1/26/2019"}),{1,2,3,4,""}),"")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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