Formula for returning value based on whether a date is between two dates
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
-
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
-
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
-
This worked perfectly. Thank you so much!!!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 67.8K Get Help
- 474 Global Discussions
- 205 Use Cases
- 516 Announcements
- 5.5K Ideas & Feature Requests
- 87 Brandfolder
- 157 Just for fun
- 82 Community Job Board
- 522 Show & Tell
- 36 Member Spotlight
- 3 SmartStories
- 309 Events
- 37 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!