Index/Collect for last non blank value looping
I'm trying to get the last non blank date value if the value that pulls is blank. We have a sheet that make a separate line for each part of a process, and has the dates for each start. The "Start Date" column should fill with the date that corresponds to the Index for that Run. In the below example, they have a start date for Run 1 and Run 3, but not for 2, 4, or 5.
I'm able to get the "Start Date" to fill if the current run is blank, but the row above it has a date (example, run 2 pulls run 1's date and run 4 pulls run 3's date). Is there a way to get the formula to keep looping if the pulled value is also blank (example, run 5 would pull run 4, but that's blank).
Formula I have written now:
=IF([Start Date]@row <> "", INDEX(COLLECT([Start Date]:[Start Date], [Project Name]:[Project Name], [Project Name]@row), Index@row), INDEX(COLLECT([Start Date]:[Start Date], [Project Name]:[Project Name], [Project Name]@row), Index@row - 1))
Thanks!
Answers
-
Hi @mwat4482, this should work:
=INDEX(COLLECT([Start Date]:[Start Date], [Project Name]:[Project Name], [Project Name]@row, [Start Date]:[Start Date], <>"", Index:Index, <=Index@row), 1)
-
Hi @Lucas Rayala,
That's causing it to pull the date on the 1st run, even if that run has a date or the run before it has a date. Do you know how to get it to populate with the index before it, not index 1?
-
Hi @mwat4482, sorry about the lag in response. I think I see what you're asking now. Can you try this?
=INDEX([Start Date]:[Start Date], MATCH(MAX(COLLECT(Index:Index, [Project Name]:[Project Name], [Project Name]@row, [Start Date]:[Start Date], <>"", Index:Index,<=Index@row)), Index:Index,0))
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 65.2K Get Help
- 445 Global Discussions
- 143 Industry Talk
- 476 Announcements
- 5K Ideas & Feature Requests
- 84 Brandfolder
- 150 Just for fun
- 71 Community Job Board
- 488 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 301 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!