Find the row with the earliest Created (Entered) date that matches certain criteria
This one was a challenge. I thought I had it solved, but an erroneous value showed up, necessitating taking the formula back to the drawing board.
The requirement: Show me the oldest Bill of Lading number that does not have a status of "Closed" or "Canceled." In another cell, show me the full Created dateand timeof that Bill of Lading. In a third cell, show me the Bill of Lading number together with the Created date and time.
Sheets: The formulas are present on a metrics sheet that is pulling data from our BOL Active Tracking sheet, and then the results are presented on a large dashboard screen in the warehouse.
Incorrect Solution: To find the BOL number, I first used the following:
=INDEX({BOL Active Tracking BOL Number}, MATCH(MIN(COLLECT({BOL Active Tracking Created}, {BOL Active Tracking Status}, @cell <> "CLOSED", {BOL Active Tracking Status}, @cell <> "CANCELED")), {BOL Active Tracking Created}, 0)) + ""
The problem with this was that when I had two or more BOLs that had been entered at the same date/time (date, hour, minute,) and one of them became the oldest one not yet Closed or Canceled, the formula returned whichever BOL number was lower numerically. It was not considering the Status field at this point, because it was only taking the first BOL Number where the dates matched.
Correct Solution: A split of the formula into one to retrieve the earliest Created date that matches the criteria, and another to find the BOL Number for the row based on that result thatalsomatches the same criteria. Additionally, a helper formula for conversion of the date value into text, and another for displaying the BOL Number and the Created date/time together in one cell.
Formula 1, Find the Date:
On the metrics sheet, in a date column called “Date,” return the earliest Created Date from BOL Active Tracking where the status is not CLOSED or CANCELED:
=MIN(COLLECT({BOL Active Tracking Created}, {BOL Active Tracking Status}, <>"CLOSED", {BOL Active Tracking Status}, <>"CANCELED"))
Result: 06/02/20
I am collecting this date value as a date format, in order for the MIN function to work properly on it, and for the following function to be able to match the Created dates.
Formula 2, Find the BOL Number:
On the metrics sheet, return the first BOL Number from BOL Active Tracking where the Created date matches the date retrieved in the first formula, and where the status is not CLOSED or CANCELED:
=指数(收集({Tracki波尔活跃ng BOL Number}, {BOL Active Tracking Status}, <>"CLOSED", {BOL Active Tracking Status}, <>"CANCELED", {BOL Active Tracking Created},[email protected]), 1) + ""
Result: 97553662
I am converting the result from number to text at the end of the formula using +"". This is because I am concatenating the result with the Created Date/Time that I pull into another cell using the same MIN/COLLECT code from the first function.
公式3,找到哒teand timein Text format:
This is the same formula as the first one, with the addition of the text conversion. Without the conversion to text, the collected Created date value only displays the date without the time portion:
=MIN(COLLECT({BOL Active Tracking Created}, {BOL Active Tracking Status}, <>"CLOSED", {BOL Active Tracking Status}, <>"CANCELED")) + ""
Result: 06/02/20 7:59 AM
Formula 4, making it pretty:
Concatenating the text-converted collected BOL Number cell and the Created date/time cell gives me a single cell with the BOL Number and the Created date/time:
=[BOL Number]@row + " - " +[email protected]
Result: 97553662 – 06/02/20 7:59 AM
On the warehouse dashboard screen, the users now see the correct value, and know at a glance which BOL is getting left behind.
Regards,
Jeff Reisman,IT Business Analyst & Project Coordinator,Mitsubishi Electric Trane US
链接:Smartsheet Functions Help Pages链接:Smartsheet Formula Error Messages
Answers
-
Stefan ✭✭✭✭
Hi Jeff,
thanks for sharing with the community with all the detailed steps !
Greetings
Stefan
Smartsheet Consulting, Solution Building, Training and Support.
Projects for Processes and for People.
0 -
Hello. I am looking for something very similar but not as complex. All I am wanting to to show the "Date Created" from the oldest to newest or even dates exceeding 30 days and display it on a dash.
Should I be entering the formula on the sheet summary? I know this is a simple solution but I just cannot get it. I thank you in advance.
0 -
Jeff Reisman ✭✭✭✭✭
You should be able to do that with a report. You have multi-level sort options and filters. You can sort by date created oldest to newest, and filter out anything newer than 30 days. Report data can be displayed on a dashboard.
Regards,
Jeff Reisman,IT Business Analyst & Project Coordinator,Mitsubishi Electric Trane US
链接:Smartsheet Functions Help Pages链接:Smartsheet Formula Error Messages
0 -
Jeff,
I knew I was overthinking it! Thank you so much!
0
Help Article Resources
Categories
=SUBSTITUTE([Primary Column]@row, \" \", \"%20\")\n<\/pre>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question","log":{"dateUpdated":"2022-09-03 11:16:07","updateUser":{"userID":152031,"name":"austinov","url":"https:\/\/community.smartsheet.com\/profile\/austinov","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-09-03T11:16:11+00:00","banned":0,"punished":0,"private":false,"label":"✭"}}},"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":95022,"type":"question","name":"Determine if form submissions are missing","excerpt":"Hi there. We have 16 geographically dispersed service locations who perform time of service collections and bank deposits. Our finance team needs to capture and reconcile these collections & deposits on a daily basis. I have created a form to collect time of service collection information from each location, and I'm trying…","categoryID":322,"dateInserted":"2022-09-02T17:59:05+00:00","dateUpdated":null,"dateLastComment":"2022-09-02T20:41:55+00:00","insertUserID":99446,"insertUser":{"userID":99446,"name":"JS_NCHC","url":"https:\/\/community.smartsheet.com\/profile\/JS_NCHC","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-09-02T22:15:46+00:00","banned":0,"punished":0,"private":false,"label":""},"updateUserID":null,"lastUserID":99446,"lastUser":{"userID":99446,"name":"JS_NCHC","url":"https:\/\/community.smartsheet.com\/profile\/JS_NCHC","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-09-02T22:15:46+00:00","banned":0,"punished":0,"private":false,"label":""},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":1,"countViews":21,"score":null,"hot":3324293460,"url":"https:\/\/community.smartsheet.com\/discussion\/95022\/determine-if-form-submissions-are-missing","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/95022\/determine-if-form-submissions-are-missing","format":"Rich","lastPost":{"discussionID":95022,"commentID":342319,"name":"Re: Determine if form submissions are missing","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/342319#Comment_342319","dateInserted":"2022-09-02T20:41:55+00:00","insertUserID":99446,"insertUser":{"userID":99446,"name":"JS_NCHC","url":"https:\/\/community.smartsheet.com\/profile\/JS_NCHC","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-09-02T22:15:46+00:00","banned":0,"punished":0,"private":false,"label":""}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2022-09-02T20:46:38+00:00","dateAnswered":"2022-09-02T20:41:55+00:00","acceptedAnswers":[{"commentID":342319,"body":"Hi again. I figured out the core formula I needed, so I thought I'd update my post in case others have similar questions in the future.<\/p>
Form for submission is part of \"Daily Collections\" sheet, and SITE NAME is the site submitting the form. I created an Audit sheet with a list of SITE NAME's, and look to the Daily Collections sheet to determine if at least one submission matches with SITE NAME, resulting in \"Y\" or \"N\".<\/p>
=IF(COUNTIF({Daily Collections SITE NAME}, =SITE NAME@row) > 0, \"Y\", \"N\")<\/p>
Thanks! 😁<\/span><\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question","log":{"dateUpdated":"2022-09-02 20:46:38","updateUser":{"userID":99446,"name":"JS_NCHC","url":"https:\/\/community.smartsheet.com\/profile\/JS_NCHC","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-09-02T22:15:46+00:00","banned":0,"punished":0,"private":false,"label":""}}},"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":95016,"type":"question","name":"Countifs with multiple sheet references and CONTAINS","excerpt":"Hi! I am struggling with how to build the correct formula to provide the result of the following scenario: I am using the Smartsheet \"Fruit Sheet\" to create a formula in the Smartsheet \"Orchard\" Search \"Fruit Sheet\" for any \"Apples\" that may be \"Red\" in the \"Summer\" The sheet has several fruits and several apples. The…","categoryID":322,"dateInserted":"2022-09-02T14:58:09+00:00","dateUpdated":"2022-09-02T15:08:46+00:00","dateLastComment":"2022-09-02T15:55:50+00:00","insertUserID":152024,"insertUser":{"userID":152024,"name":"MoyaC","url":"https:\/\/community.smartsheet.com\/profile\/MoyaC","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-09-02T15:56:00+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":91566,"lastUserID":152024,"lastUser":{"userID":152024,"name":"MoyaC","url":"https:\/\/community.smartsheet.com\/profile\/MoyaC","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-09-02T15:56:00+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":32,"score":null,"hot":3324266039,"url":"https:\/\/community.smartsheet.com\/discussion\/95016\/countifs-with-multiple-sheet-references-and-contains","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/95016\/countifs-with-multiple-sheet-references-and-contains","format":"Rich","lastPost":{"discussionID":95016,"commentID":342299,"name":"Re: Countifs with multiple sheet references and CONTAINS","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/342299#Comment_342299","dateInserted":"2022-09-02T15:55:50+00:00","insertUserID":152024,"insertUser":{"userID":152024,"name":"MoyaC","url":"https:\/\/community.smartsheet.com\/profile\/MoyaC","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2022-09-02T15:56:00+00:00","banned":0,"punished":0,"private":false,"label":"✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2022-09-02T15:55:57+00:00","dateAnswered":"2022-09-02T15:46:55+00:00","acceptedAnswers":[{"commentID":342297,"body":"