Formula for first/last value based on year.
I have a large sheet where employees completed inventory checks every week over the last few years. Trying to figure out a formula to get the first and last entry based on a cell that contains last years "year". This is to gather our yearly starting inventory and yearly ending inventory.
This is the formula I have to get the last quantity entered on the sheet but I cannot figure out how to incorporate the cell with last year as a criteria.
=IFERROR(INDEX({Item 1}, MATCH(MAX(COLLECT({DATE}, {Item 1}, @cell <> "")), {DATE}, 0)), "")
Answers
-
@Brandon22 You'd need to have the year on every row, alternatively, if you have the date on every row you could check the year of the date with the YEAR() funciton.
Darren Mullen, join the Smartsheet Guru Elite
Get my 7 Smartsheet tips here
Author of: Smartsheet Architecture Solutions
-
Hi @Darren Mullen thank you for your help but I don't fully understand. I want to have the formulas on each row connected to a date I can change at the top of the sheet (under last year) to collect the first and last entries of whichever year I enter there.
So basically in the cell intersecting Item 1 and Yearly Ending Inventory, I would want it to populate "132" as that was the last entry in my reference sheet for the year 2022.
Would I be able to do this with modifying a simpler formula such as:
=MIN(COLLECT({Item 1}, {Created}, [Daily Use]2))
-
@Brandon22 You would need some more complex than that. What you proposed would give you the minimum item number. It would take some thought to come up with something.
Darren Mullen, join the Smartsheet Guru Elite
Get my 7 Smartsheet tips here
Author of: Smartsheet Architecture Solutions
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 65.1K Get Help
- 444 Global Discussions
- 140 Industry Talk
- 472 Announcements
- 5K Ideas & Feature Requests
- 83 Brandfolder
- 150 Just for fun
- 71 Community Job Board
- 497 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 35 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!