Returning a value if a date is between 3 different ranges

jameslarsen1995

New Member
Joined
Mar 2, 2022
Messages
2
Office Version
  1. 2021
Platform
  1. Windows
Let's say I have a date in A1 and I have 3 different date ranges. My date ranges are:
1/1/2020 - 12/31/2020, 1/1/2021 - 12/31/2021, and 1/1/2022 - 12/31/2022

So if my date in A1 is between the first set, then I want it to return a '1', if it falls between the second set then return '2', etc.

Thank You
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Thanks so much for this. What if I need to change my date ranges to 1/31/20-1/31/21 and 2/1/21-1/31/2022 and 2/1/22-1/31/2022?
 
Upvote 0
I would create a lookup table if the goalposts were moving. Depends as i cant see you sheet. However if you cant you could do something like:

=IF(A1>=DATE(2023,1,31),"Out of range",IF(A1>=DATE(2022,1,31),3,IF(A1>=DATE(2021,1,31),2,IF(A1>=DATE(2020,1,31),1,"Out of range"))))
 
Upvote 0
Solution

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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