Formula for returning value based on whether a date is between two dates

Options

I have a main sheet and a reference sheet. On the main sheet there is a Fiscal Quarter which is based on a Program Date column. HOwever, I want to add a formula that refers to a reference sheet whereby I have two dates. If the Program date falls within the Start Date and End Date of a quarter, I want the formula to return the value from the Primary Column see below.

I thought Index Collect with two criterion would be best but I can't get it to work. Thoughts?


Best Answer

  • Kelly Moore
    Kelly Moore ✭✭✭✭✭✭
    Answer ✓
    Options

    Hey @Pfarrell

    You are right with using the Index/Collect

    Try this. Note you must physically create the cross-sheet references in your sheet via the formula wizard window. You cannot simply copy paste this formula into your sheet. Your range names will look different than the ones I inserted in my formula- that is to be expected

    =INDEX(COLLECT({Reference sheet Primary column}, {Reference sheet Start Date}, [Program Date]@row >= @cell, {Reference Sheet End Date}, [Program Date]@row <= @cell), 1)

    Does this work for you?

    Kelly

Answers

  • Kelly Moore
    Kelly Moore ✭✭✭✭✭✭
    Answer ✓
    Options

    Hey @Pfarrell

    You are right with using the Index/Collect

    Try this. Note you must physically create the cross-sheet references in your sheet via the formula wizard window. You cannot simply copy paste this formula into your sheet. Your range names will look different than the ones I inserted in my formula- that is to be expected

    =INDEX(COLLECT({Reference sheet Primary column}, {Reference sheet Start Date}, [Program Date]@row >= @cell, {Reference Sheet End Date}, [Program Date]@row <= @cell), 1)

    Does this work for you?

    Kelly

  • Pfarrell
    Options

    This worked perfectly. Thank you so much!!!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!