Returning a ship date from another sheet based on matching item and order number?
I am trying to find a formula to pull a ship date from another sheet if two criteria match.
Here's a representation of the data in the main sheet and in the ship date sheet:
So if both order# and part number match, the formula would insert the ship date from the other sheet.
Is this doable? I've messed around with IF, INDEX, COLLECT, JOIN, VLOOKUP but not having much luck.
Also due to the cell limit I've had to split the ship dates into two sheets (ship dates 1 & ship dates 2), but the main sheet may need to look up the data from either sheet. Is it possible to reference two sheets in one formula?
I've tried searching help and the forums - any assistance would be greatly appreciated!
Answers
-
Werner Gerstacker ✭✭✭✭✭
I haven't tried it in Smartsheet yet, but I've done it in Excel with a SUMIFS - as long as each Order#/Part Number line only has one ship date that should work fine. At least it does in Excel because dates are simply stored as numbers there.
Maybe you can handle the split between two sheets by 'adding' two SUMIFS together, the sheet that doesn't have the right reference should just return a 0 so nothing is added to the result form the other sheet. If the formula for the sheet without the correct reference returns an error just wrap both SUMIFS parts separately into IFERROR functions.
-Werner
-
Hi Werner,
Thank you for the response! I'm not entirely sure how to do what you kindly suggested - could you please give an example of a working formula?
- Natalie
-
Werner Gerstacker ✭✭✭✭✭
my idea was to do something like this:
The formula is:
=SUMIFS([Sheet 1 - Ship Date]:[Sheet 1 - Ship Date], [Sheet1 - Order Number]:[Sheet1 - Order Number], [Order Number]@row, [Sheet1 - Part Number]:[Sheet1 - Part Number], [Part Number]@row) + SUMIFS([Sheet 2 - Ship Date]:[Sheet 2 - Ship Date], [Sheet1 - Order Number]:[Sheet1 - Order Number], [Order Number]@row, [Sheet1 - Part Number]:[Sheet1 - Part Number], [Part Number]@row)
But while this works fine in Excel, it does not in Smartsheet.
It seems to have to do with the way dates are handled in Smartsheet - at works fine for numbers, of course.
Maybe somebody else has an idea how the use a SUMIF with dates.
Other than that, I think a COLLECT function might work but I'm not really a specialist there.
-
Paul Newcome ✭✭✭✭✭✭
You could try something like this...
=IF(COUNTIFS({Date Sheet 1 Order Number}, [Order#]@row, {Date Sheet 1 Part Number}, [Part Number]@row) > 0, INDEX(COLLECT({Date Sheet 1 Ship Date}, {Date Sheet 1 Order Number}, [Order#]@row, {Date Sheet 1 Part Number}, [Part Number]@row), 1), INDEX(COLLECT({Date Sheet 2 Ship Date}, {Date Sheet 2 Order Number}, [Order#]@row, {Date Sheet 2 Part Number}, [Part Number]@row), 1)
Basically we have an INDEX/COLLECT to pull the matching ship date from Date Sheet #1. We then replicate it for Date Sheet #2.
Then we use a COUNTIFS to see if there is a matching row in Date Sheet #1 and drop that in an IF statement to say that if the count is greater than zero, pull from Date Sheet #1, otherwise pull from Date Sheet #2.
=IF(count on sheet 1> 0, pull from sheet 1, pull from sheet 2)
-
Werner Gerstacker ✭✭✭✭✭
Just thought about a trick I used to use for Excel - adding a helper column with the combined values you're looking for in a VLOOKUP:
=IFERROR(VLOOKUP([O&P]@row, [Sheet1 - Helper]:[Sheet1 - Ship Date], 2, false), IFERROR(VLOOKUP([O&P]@row, [Sheet2 - Helper]:[Sheet2 - Ship Date], 2, false), ""))
The Helper columns O&P, Sheet1 - Helper and Sheet2 - Helper are set up with this kind of formula:
=[Order Number]@row + " - " + [Part Number]@row
-
Paul Newcome ✭✭✭✭✭✭
@Werner GerstackerYou could also use an INDEX/COLLECT to avoid needing the helper columns.
-
Werner Gerstacker ✭✭✭✭✭
I have used the collect function before - but always have trouble to wrap my head around it.
And from what I've seen in the forum here, I am by far not the only one
VLOOKUP是更容易包装的概念brain around I'm just offering an alternative approach.
-
Paul Newcome ✭✭✭✭✭✭
@Werner GerstackerNo worries. It took me a while to get a feel for it. The best way I can explain it is that you enter the range you want to collect FIRST then alternate criteria range 1, criteria 1, criteria range 2, criteria 2, criteria range 3, criteria 3, ..............................
Once I got the hang of the COLLECT function, so many new possibilities presented themselves. It is kind of like adding an "IFS" to a function.
Want to JOIN cells that meet specific criteria but we don't have a JOINIFS?
=JOIN(COLLECT({range to join}, {Criteria range 1}, criteria 1, {Criteria range 2}, criteria 2), "delimiter")
Want to pull the most recent date from a range but only if it meets certain criteria?
=MAX(COLLECT({date column to run MAX function on}, {Criteria range 1}, criteria 1, {Criteria range 2}, criteria 2))
I must say though... I do like your IFERROR/IFERROR combo. That could probably be used on my solution instead of the IF/COUNTIFS. I hadn't thought of something like that before.
=IFERROR(INDEX(COLLECT({Date Sheet 1 Ship Date}, {Date Sheet 1 Order Number}, [Order#]@row, {Date Sheet 1 Part Number}, [Part Number]@row), 1), INDEX(COLLECT({Date Sheet 2 Ship Date}, {Date Sheet 2 Order Number}, [Order#]@row, {Date Sheet 2 Part Number}, [Part Number]@row), 1))
or
=IFERROR(INDEX(COLLECT({Date Sheet 1 Ship Date}, {Date Sheet 1 Order Number}, [Order#]@row, {Date Sheet 1 Part Number}, [Part Number]@row), 1), IFERROR(INDEX(COLLECT({Date Sheet 2 Ship Date}, {Date Sheet 2 Order Number}, [Order#]@row, {Date Sheet 2 Part Number}, [Part Number]@row), 1), ""))
Help Article Resources
Categories
Check out theFormula Handbook template!
Instead of applying the formula to \"Multiselect Text String\" row, did you tried with \"Multiselect Values\" row?<\/p>
=IF(HAS([Multiselect Values]@row, [Component ID]@row), \"MATCH\", \"NO MATCH\")<\/p>
Thank you,<\/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":109493,"type":"question","name":"I am having trouble using \"And\", \"OR\" & \"Countif(s)\" to build a formula.","excerpt":"Hello, I am attempting to come up with a sheet summary formula that counts cells if they meet at least one of 3 different statuses in the same column, AND also meet one of 5 different statuses in a separate column. So using the screenshot I've provided as an example (although it doesn't have 5 different statuses in the…","snippet":"Hello, I am attempting to come up with a sheet summary formula that counts cells if they meet at least one of 3 different statuses in the same column, AND also meet one of 5…","categoryID":322,"dateInserted":"2023-08-25T20:03:21+00:00","dateUpdated":null,"dateLastComment":"2023-08-26T00:34:49+00:00","insertUserID":165710,"insertUser":{"userID":165710,"name":"SmarsheetNewb","url":"https:\/\/community.smartsheet.com\/profile\/SmarsheetNewb","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-26T00:33:27+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-08-27T02:16:35+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":26,"score":null,"hot":3386005690,"url":"https:\/\/community.smartsheet.com\/discussion\/109493\/i-am-having-trouble-using-and-or-countif-s-to-build-a-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109493\/i-am-having-trouble-using-and-or-countif-s-to-build-a-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109493,"commentID":392692,"name":"Re: I am having trouble using \"And\", \"OR\" & \"Countif(s)\" to build a formula.","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392692#Comment_392692","dateInserted":"2023-08-26T00:34:49+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-08-27T02:16:35+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,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-26T00:33:25+00:00","dateAnswered":"2023-08-25T20:44:12+00:00","acceptedAnswers":[{"commentID":392662,"body":"
Try this:<\/p>
=COUNTIFS([Item Number]:[Item Number], OR(@cell = \"C001\", @cell = \"COO2\", @cell = \"COO3\", @cell = \"COO4\"), [Status]:[Status], OR(@cell = \"Green\", @cell = \"Yellow\", @cell = \"Red\"))<\/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"}]},{"discussionID":109474,"type":"question","name":"Help with date calculation formula","excerpt":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the resolution date is blank I want it to use the current date in the calculation to see how long this issue has gone unresolved. Any help is much…","snippet":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the…","categoryID":322,"dateInserted":"2023-08-25T16:29:39+00:00","dateUpdated":"2023-08-25T16:29:59+00:00","dateLastComment":"2023-08-25T23:01:30+00:00","insertUserID":165688,"insertUser":{"userID":165688,"name":"Nwest","title":"Systems Analyst","url":"https:\/\/community.smartsheet.com\/profile\/Nwest","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ukHVZ18ImX4!BcjWAe8S9SY!l7iQo_PZHOx","dateLastActive":"2023-08-25T17:22:30+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":165688,"lastUserID":8888,"lastUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":25,"score":null,"hot":3385987269,"url":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109474,"commentID":392687,"name":"Re: Help with date calculation formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392687#Comment_392687","dateInserted":"2023-08-25T23:01:30+00:00","insertUserID":8888,"insertUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+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,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-25T17:04:22+00:00","dateAnswered":"2023-08-25T16:36:59+00:00","acceptedAnswers":[{"commentID":392622,"body":"