Evaluating the most recent date from one sheet and updating another
Hi all, this one has me stumped. In the Last Service Date column for an asset, I'm trying to get the date of the latest service on that asset from another sheet.
I have a Sheet- Maintenance Log that has rows of maintenance activities for assets like air conditioners, fans, etc. I have a date from Sheet- Maintenance Log in a column Date Service Completed that tells me when the date was of the service. I want to take the most recent service date from from the Sheet- Maintenance Log and update an asset row in Sheet- Asset Tracker based on the asset number. Below is the formula I've tried. Any help is appreciated.
=INDEX(COLLECT({Sheet - Ongoing Maintenance-Date Completed}), {Sheet - Ongoing Maintenance-COE Asset ID Num}, ISDATE(@cell), {Sheet - Ongoing Maintenance-Date Completed}, [Latest Date]@row, {Sheet - Ongoing Maintenance-COE Asset ID Num},1)
Best Answer
-
The 1 is part of the INDEX function. In this case it was telling it to pull the first row it matched on.
But the MAX function pulls the largest value (or most recent date) so it is essentially "built in" and will cause that error.
Answers
-
It looks like you have a misplaced parenthesis. Try this:
=INDEX(COLLECT({Sheet - Ongoing Maintenance-Date Completed}, {Sheet - Ongoing Maintenance-COE Asset ID Num}, ISDATE(@cell), {Sheet - Ongoing Maintenance-Date Completed}, [Latest Date]@row, {Sheet - Ongoing Maintenance-COE Asset ID Num}),1)
-
This gives me #unpareseable.
-
Can you provide a screenshot of the formula actually in the cell?
-
It is not recognizing [Latest Date] as a valid column name.
I also had just copy/pasted your formula to correct the parenthesis issue, but looking closer at it, it looks like your overall syntax may be off. You are pulling in the Date Completed where...
ID Num is a date
Date Completed is equal to [Latest Date]@row
and then you don't have any criteria for the last range (ID Num again)
-
Well bugger. Since I want the biggest or in other words the most recent date for an asset from the range that is on {Sheet - Ongoing Maintenance-Date Completed}, should I use a MAX formula with collect as shown below.
=max(collect({Sheet - Ongoing Maintenance-Date Completed}, {Sheet - Ongoing Maintenance-COE Asset ID Num}, [COE Asset ID Num]@row, 1))
Unfortunately, this gives me #incorrect argument set.
-
That syntax is more accurate in regards to the order of things, but you need to remove the comma-space-1 from the end.
-
HALLELUIAH, halleluiah and thank you. BTW, what does the ", 1" do? I watch videos and read and it says to do it, but I don't know why. It is working fine now.
-
The 1 is part of the INDEX function. In this case it was telling it to pull the first row it matched on.
But the MAX function pulls the largest value (or most recent date) so it is essentially "built in" and will cause that error.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 439 Global Discussions
- 138 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 67 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!