Index(Match()): Lookup a price of a product from another sheet but keep historical entries
Hi am am hoping to lookup a price of a product from another sheet based however keeping historical price changes.
年代martsheet A: We have production runs of product XYZ listed in a sheet A. Based on a concat we want to lookup a product price based on the MOST RECENT entry from Smartsheet B. However we want to keep Entry A of Product XYZ different than Entry B assuming the pricing has changed from Entry A to Entry B .
年代martsheet B is updated and time stamped when there is a pricing change of Product XYZ.
Index(match() works great if we are pulling pricing without date considerations. how could I incorporate dates into my Index(Match()?
Answers
-
年代oS | Dan Palenchar ✭✭✭✭✭✭
This is a little tricky not having the Sheets to work with, but I think something like the below could work
=SUM(COLLECT({Price in Sheet B}, {Product List in Sheet B}, [Product Column]@row, {TimeStamp Column}, MAX(COLLECT({TimeStamp Column}, {Product List in Sheet B}, [Product Column]@row))))
Theoretically, the first MAX(COLLECT()) at the end pulls out the single highest time stamp for the product in question, that value is used in the first COLLECT() formula to pull out the price for the product you are searching for where the time stamp is equal to the max time stamp. The SUM is used so it will return a number instead of an error.
There are probably several ways to approach, perhaps with summary fields on your Sheet A either in the Sheet Summary section or as a parent row with all entries as children...
-
Paul Newcome ✭✭✭✭✭✭
If the prices on Sheet B are updated in the same cell (meaning old prices are "overwritten" with the new prices), then I would suggest the INDEX/MATCH to pull the price and then a Move Row automation to push that row from Sheet A to a 3rd Sheet which would be your actual working sheet. The Move Row automation captures the static data, so update son Sheet B won't affect the previously pulled pricing.
@SoS | Dan PalencharHave you tested your formula? When I have used a COLLECT inside of a COLLECT like that in the past, I have gotten a #NESTED CRITERIA error.
I believe you are also assuming that price updates are new entries so you could theoretically have multiple listings for "Product A" with different prices.
I would instead suggest a helper column that replicates the row numbers on Sheet B and then using something along the lines of...
=INDEX({Sheet B Price Column}, MAX(COLLECT({Sheet B Helper Column}, {Sheet B Product Column}, [Product Column]@row))
This also assumes that updates to the price list on Sheet B are new entries at the bottom of the sheet. If they are entries at the top of the sheet, then we would need to do a little tweaking either to the Helper Column or the INDEX formula.
thinkspi.com
-
年代oS | Dan Palenchar ✭✭✭✭✭✭
@Paul Newcome我没有测试,实际上从未尝试过COLLECT in a COLLECT myself before, so I assume you're right and it won't work (also, good to know about that). And yes, I was assuming price updates as new rows (e.g., Entry A vs Entry B).
Your way looks better️
Help Article Resources
Categories
Check out theFormula Handbook template!
Hi @John Littler<\/a> <\/p> I hope you're well and safe!<\/p> Try something like this.<\/p> Did that work\/help? <\/p> I hope that helps!<\/p> Be safe, and have a fantastic week!<\/p> Best,<\/p> Andrée Starå<\/strong><\/a> | Workflow Consultant \/ CEO @ WORK BOLD<\/strong><\/a><\/p> ✅Did my post(s) help or answer your question or solve your problem? Please support the Community by <\/em>marking it Insightful\/Vote Up, Awesome, or\/and as the accepted answer<\/em><\/strong>. It will make it easier for others to find a solution or help to answer!<\/em><\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":107942,"type":"question","name":"How do I return DISTINCT values from another sheet based on specific dates within that sheet?","excerpt":"Hello, I have a need to return a Distinct Item ID from another sheet based on a date range from another date column within that same external sheet. The formula below works; however, once I run out of Distinct item IDs that meet my date criteria it continues to return results that fall outside that date range. Current…","snippet":"Hello, I have a need to return a Distinct Item ID from another sheet based on a date range from another date column within that same external sheet. The formula below works;…","categoryID":322,"dateInserted":"2023-07-22T00:19:14+00:00","dateUpdated":null,"dateLastComment":"2023-07-24T14:28:01+00:00","insertUserID":123219,"insertUser":{"userID":123219,"name":"Matt Foss","url":"https:\/\/community.smartsheet.com\/profile\/Matt%20Foss","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!bCFRG7SgS_o!w6Nev-KRhHQ!jkKTibQm-FP","dateLastActive":"2023-07-24T14:20:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":161714,"lastUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-07-24T20:48:40+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":31,"score":null,"hot":3380195835,"url":"https:\/\/community.smartsheet.com\/discussion\/107942\/how-do-i-return-distinct-values-from-another-sheet-based-on-specific-dates-within-that-sheet","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/107942\/how-do-i-return-distinct-values-from-another-sheet-based-on-specific-dates-within-that-sheet","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":107942,"commentID":386638,"name":"Re: How do I return DISTINCT values from another sheet based on specific dates within that sheet?","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/386638#Comment_386638","dateInserted":"2023-07-24T14:28:01+00:00","insertUserID":161714,"insertUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-07-24T20:48:40+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/74OMVUEY31TO\/example.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"Example.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-07-24T14:20:29+00:00","dateAnswered":"2023-07-22T02:23:22+00:00","acceptedAnswers":[{"commentID":386531,"body":" I think this is what you are trying to accomplish. I assume you are dragging the formula down, as this will not work as a column formula due to the absolute references. There were a few issues with the formula you posted, maybe there were some typos when transferring it to your post? <\/p> =IFERROR(INDEX(DISTINCT(COLLECT({Item ID}, {Create Date}, >= $[Start Date]$1, {Create Date}, <= $[End Date]$1)), [Row ID]@row), \"//m.santa-greenland.com/community/discussion/69875/\")<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"Formulas","name":"Formulas"}]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=322&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":10000,"limit":3},"title":"Trending in Formulas and Functions ","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">
=IF(OR(Idea34 = \"//m.santa-greenland.com/community/discussion/69875/\", Idea58 = \"//m.santa-greenland.com/community/discussion/69875/\"), \"//m.santa-greenland.com/community/discussion/69875/\", IF(OR(Idea34 < 0, Idea58 < 0), \"Red\", \"Green\"))\n<\/pre>