Formula to auto-populate data base on date range
With reference to the above, we are trying to do the following:
The "Date columns" (1/1/22, 2/1/22...) to capture the "10. Unit" when it matches the Start and End date.
The scenario is that we have 20 beds in the dormitory and there will be different crew who will need to stay in on different time. We have to ensure it doesn't exceed the limit. Therefore we are trying to capture the date range and the number of beds taken.
Currently, we are using another sheet to have all the dates, and to use a cross-sheet reference to say if "1/1/22 is between Start Date and End Date, then return the Unit to this cell". In doing this, we have to create a distinct reference for 365 days of the year.
Is there a better way to do this?
Appreciate any assistance or suggestion.
Thanks.
Answers
-
Hi @Vivien Chong ,
Try something like this in the 01/01/22 column:
=IF(AND(DATE(2022,01,01)>=[11. start date]@row,DATE(2022,01,01)<=[12. end date]@row),[10. Unit]@row,"")
The (2022,01,01) will need to be changed for each column (YYYY,MM,DD). For example, the 02/01/2022 column will read =IF(AND(DATE(2022,02,01)>=[11. start date]@row,DATE(2022,02,01)<=[12. end date]@row),[10. Unit]@row,"")
Let me know if it works for you!
Best,
Heather
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 434 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!