# Assign a value based on a date range

Options
✭✭✭✭
edited 12/09/19

Hi everyone,

Fairly newish user when it comes to formulas here; please forgive me if this has been answered elsewhere and I missed it in my searching.

I'm wanting to assign a value to a column named Bucket based on the value in the Start column for any given task. The date ranges look like this (using a numbered list for the bucket value, because why not):

1. 2/20/20 - 2/26/20
2. 2/27/20 -  3/4/20
3. 3/5/20 - 3/11/20
4. 3/12/20 - 3/18/20

...and so on. This particular portion of the project should take no more than 10-12 weeks to complete.

Is there an easier way to do this than nested IF statements? So far I've been thinking down the track of

=IF([Start]@row&gt;2/19/20<2/27/20,"1",IF([Start]@row ...) etc. In pseudocode.

Thoughts?

Thanks!

Tags:

• ✭✭✭✭
Options

Hi Kolfinna

=IF(AND([Start]@row&gt;=2/20/20,End]@row&lt;=2/26/20),1,IF(AND([Start]@row&gt;=2/27/20,[End]@row&lt;=3/4/20),2,""))

(I typed the date for the sake of example, but it's recommended to link to the correct cell)

I hope it helps.

• ✭✭✭✭✭✭
Options

How many buckets will you have?

If it is just a few, then nested IF's are going to be your best bet, but if you have quite a few different buckets, there is a way to set up a table then use an INDEX/MATCH with a combination of MIN/MAX built in to reference.

• ✭✭✭✭
Options

So--things changed flow, as they tend to do. Basically we're flipping it on its head and assigning start date based on both the bucket number (1-7) as well as a new criteria (morning, midday, and night). Work is only going to be performed on M/W/F each week, so there's 21 permutations total.

Super curious about your suggestion, especially as we get closer to our start date, times will shift from generic windows to specific hours e.g., 0000-0800 could be the min/max for a morning window.

Would I go about setting up that table in the same spreadsheet, or a different sheet? I'd rather do the work only once if I could.

Thanks!

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!