Get the latest value, based on a date, from a specific value.
I know that i will probably have to use Index, Max and Collect. I Just don't know how.
This is the "Registry" table which is going to display the last value, based on the last date, based on the product SKU. Only with "In"s.
And This is the "Movements table" which logs all the data.
(This structure has the objective to record the last price wich the material was purchased.)
As i've said, i tried using Max Collect Index, but with no success.
Best Answer
-
Ok. Swear I've got it this time.
First you need to create a helper column on the target sheet to give you the max date of an "In" on a SKU. Example:
Max Date formula (format column as a date column):
=MAX(COLLECT({Created}, {In/Out}, ="In", {SKU}, =SKU@row))
Price formula:
=MAX(COLLECT({Price}, {SKU}, =SKU@row, {In/Out}, ="In", {Created}, =[Max Date]@row))
That should do it.
Answers
-
-
-
Oops. I forgot your "In" condition that was needed. Formula update:
=MAX(COLLECT({Price}, {SKU}, =SKU@row, {In/Out}, ="In"))
Results:
-
Oops again. That's not working. Back to the drawing board.
-
Ok. Swear I've got it this time.
First you need to create a helper column on the target sheet to give you the max date of an "In" on a SKU. Example:
Max Date formula (format column as a date column):
=MAX(COLLECT({Created}, {In/Out}, ="In", {SKU}, =SKU@row))
Price formula:
=MAX(COLLECT({Price}, {SKU}, =SKU@row, {In/Out}, ="In", {Created}, =[Max Date]@row))
That should do it.
-
Thank you so much, it worked like a charm.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!