Return the largest date value from an external sheet array

Hello,

I'm trying to return the max date from an external referenced sheet's system Created date column ("Response Date") based on matching the multiple values in another column in the external sheet an email address/name from the current sheet.

I've tried using =MAX(COLLECT(Response Date, Email Address Column,Email Address in current sheet)), but it seems to be returning the max date regardless of the email address criteria.

Do I need to do a MATCH first based on email address, then COLLECT? Or is the proper logic to use INDEX, MATCH and COLLECT?

Any help or insights are greatly appreciated!

Best Answer

Answers

  • David Joyeuse
    David Joyeuse ✭✭✭✭✭

    Hi@Gordon

    =MAX(COLLECT({Response Date}, {Email Address},[Email Address]@row) is what you are looking for.

    Adapt ranges and email address column name to what you are effectively using in your sheets.


    Hope it helped!

  • Gordon
    Gordon ✭✭✭✭✭

    Hi@David Joyeuse

    Thank you for the suggestion. Unfortunately, when I use your formula (replacing {Response Date} and {Email Address} with the external reference to the column range in the other sheet) the formula returns the latest date in the {Response Date} column, ignoring the email address criteria.

    Does COLLECT work with external sheet references to an entire column? Do the columns have to be next to each other in the external sheet?

    Thanks for your help!

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    COLLECT should work for this, and the columns do not have to be next to each other.


    Make sure the email data is a match on both sheets.

    thinkspi.com

  • Gordon
    Gordon ✭✭✭✭✭

    Does the column type have to match between the Criteria Range and Criteria?

    The {Email Address} is a system Created By column that is from a Smartsheet form and the {Email Address}@row reference in the current sheet is a contact list column. The{Response Date}column is setup in the external sheet as a system Created on date column.

    Thanks.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    You will need to make sure the data in the Created By column matches the data in the [Email Address] column. If you have an email in one sheet and a contact in the other, they will not match.


    So if you have[email protected]in the Created By column and John Doe in the contact type column, they will not match on each other because the text strings are different.

    thinkspi.com

  • Gordon
    Gordon ✭✭✭✭✭

    Both columns appear in Smartsheet as email addresses, but perhaps the column type is causing the mismatch and criteria to not be applied?

  • Gordon
    Gordon ✭✭✭✭✭
    edited 08/25/20

    Ok, now I think I figured out why I thought my formula wasn't working. The system columnCreateddate doesn't match what Smartsheet is evaluating the value as:

    Annotation 2020-08-24 152421.png

    TheCreatedcolumn above is originating from another sheet that captures Form data which has an automation to move rows into this sheet. The original source sheetCreatedwas setup as a system column created (date ) column.

    TheRespondedcolumn above is setup as a date column type and is a simple reference =[Created}@row formula.

    As shown above, for whatever reason, Smartsheet is showing the date incorrectly in the results in the formula.

    The 8/21/20 result is what was being output from my =MAX(COLLECT formula above, which is why I was thinking my formula was wrong.

    I get the same "8/21/20" result even if I don't use the helperRespondedcolumn and directly referenceCreatedin the =MAX(COLLECT function. I even tried using a =DATEVALUE([Created]@row) function in theRespondedcolumn - same result.

    Any idea on what is going on here? I'm totally confused why 8/20/20 at 4:28PM is the same as 8/21/20. You can see the same error in other rows as well, while some dates are correct.

  • Gordon
    Gordon ✭✭✭✭✭

    @Paul NewcomeThanks! I didn't realize that Smartsheet was being so "smart" about time zones and dates. You'd think there would be consistency at the user level such that formulas and functions should all be "smart" enough to adjust for this. I guess I sort of understand how & why they had to build out date/time based on UTC and convert at the user level. Still though, it leads to a lot confusion.

    I solved my issue by stripping out the date text from the Created column and converting it back to a date value.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Glad you got it sorted and happy to help.

    thinkspi.com

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the公式手册模板!
\n \n MicrosoftTeams-image (60).png\n <\/a>\n<\/div>\n

Hi Archie Villa,<\/strong><\/a> <\/p>

You can try this formula where I have used Count collects functions to find out distinct values in Contain column with respect to warehouse and week. <\/p>

=COUNT(DISTINCT(COLLECT(CONTAIN:CONTAIN, WAREHOUSE:WAREHOUSE, [Column6]2, WEEK:WEEK, [Column7]1))) <\/p>

Here, you just have to change the reference [Column6]2 and [Column7]1]  according to the WEEK and WAREHOUSE. <\/p>

 I have applied the formula in the Test sheet as well. <\/p>

https:\/\/app.smartsheet.com\/b\/publish?EQBCT=9a4850b961184987948525b2b6d09672&_ga=2.112388098.762379401.1689685826-1872822447.1683010570&_gl=1*gbfuhz*_ga*MTg3MjgyMjQ0Ny4xNjgzMDEwNTcw*_ga_ZYH7XNXMZK*MTY4OTc1MDAxMC45MS4xLjE2ODk3NTAwNzIuNTguMC4w<\/a> <\/p>

Hope it will work for 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":[{"tagID":254,"urlcode":"Formulas","name":"Formulas"}]},{"discussionID":107748,"type":"question","name":"Counting blank values in one cell but only if a non blank value exists in another cell","excerpt":"Good afternoon, I'm trying to create a sheet summary formula that counts the number of blank values for a cell, but only if there's an entry in the sheet because my original sheet summary was counting blank values when there wasn't an entry in the sheet. I've reviewed several posts and tried a couple of different formulas…","snippet":"Good afternoon, I'm trying to create a sheet summary formula that counts the number of blank values for a cell, but only if there's an entry in the sheet because my original sheet…","categoryID":322,"dateInserted":"2023-07-18T16:28:36+00:00","dateUpdated":null,"dateLastComment":"2023-07-18T20:14:09+00:00","insertUserID":162097,"insertUser":{"userID":162097,"name":"Nancy JOnes","title":"Project Manager","url":"https:\/\/community.smartsheet.com\/profile\/Nancy%20JOnes","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-18T20:07:17+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":162097,"lastUser":{"userID":162097,"name":"Nancy JOnes","title":"Project Manager","url":"https:\/\/community.smartsheet.com\/profile\/Nancy%20JOnes","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-18T20:07:17+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":20,"score":null,"hot":3379410165,"url":"https:\/\/community.smartsheet.com\/discussion\/107748\/counting-blank-values-in-one-cell-but-only-if-a-non-blank-value-exists-in-another-cell","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/107748\/counting-blank-values-in-one-cell-but-only-if-a-non-blank-value-exists-in-another-cell","format":"Rich","lastPost":{"discussionID":107748,"commentID":385816,"name":"Re: Counting blank values in one cell but only if a non blank value exists in another cell","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/385816#Comment_385816","dateInserted":"2023-07-18T20:14:09+00:00","insertUserID":162097,"insertUser":{"userID":162097,"name":"Nancy JOnes","title":"Project Manager","url":"https:\/\/community.smartsheet.com\/profile\/Nancy%20JOnes","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-18T20:07:17+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-07-19T12:08:03+00:00","dateAnswered":"2023-07-18T19:54:45+00:00","acceptedAnswers":[{"commentID":385811,"body":"

I just deleted some data in one of my sheets and used: <\/p>

Using a helper column: <\/p>

=COUNTIF(Date@row, \"//www.santa-greenland.com/community/discussion/comment/\")<\/p>

It seems to count the blank values but stops at the very last row that doesn't have data? Maybe this is not what you're looking for but I figured I would post just in case. <\/p>

Then you would just sum that helper column.<\/p>

If you dont want a helper column you could do this<\/p>

=SUM(Date:Date, COUNTIFS(Date:Date, \"//www.santa-greenland.com/community/discussion/comment/\", [Primary Column]:[Primary Column], <>\"//www.santa-greenland.com/community/discussion/comment/\"))<\/p>

Using the countifs statement will let you add a second criteria in this case I picked the primary column thinking there should always be data. But you can pick whatever column always has data for the 2nd criteria. <\/p>

Hope this helps.<\/p>

\n
\n \n \"image.png\"<\/img><\/a>\n <\/div>\n<\/div>\n


<\/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":107738,"type":"question","name":"Formula Help","excerpt":"Hello, I am trying to fix a formula that only partially works. Any help would be greatly appreciated. I have one column, labeled Account# with various drop-down options, multi-select. I have a second column labeled Multiple Accounts that is a checkbox column indicating when 2 or more accounts have been selected in the…","snippet":"Hello, I am trying to fix a formula that only partially works. Any help would be greatly appreciated. I have one column, labeled Account# with various drop-down options,…","categoryID":322,"dateInserted":"2023-07-18T15:00:51+00:00","dateUpdated":null,"dateLastComment":"2023-07-18T20:44:18+00:00","insertUserID":156053,"insertUser":{"userID":156053,"name":"jl.furstenberg","url":"https:\/\/community.smartsheet.com\/profile\/jl.furstenberg","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-18T16:05:05+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭"},"updateUserID":null,"lastUserID":45516,"lastUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-07-19T13:42:34+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":26,"score":null,"hot":3379407309,"url":"https:\/\/community.smartsheet.com\/discussion\/107738\/formula-help","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/107738\/formula-help","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":107738,"commentID":385826,"name":"Re: Formula Help","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/385826#Comment_385826","dateInserted":"2023-07-18T20:44:18+00:00","insertUserID":45516,"insertUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-07-19T13:42:34+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-07-19T12:07:16+00:00","dateAnswered":"2023-07-18T15:47:49+00:00","acceptedAnswers":[{"commentID":385761,"body":"

Try this:<\/p>

=IF(HAS([Account#]@row, \"1012127330\"), IF(COUNTM([Account#]@row) = 1, [Grand Total]@row, [Grand Total]@row * 0.134))<\/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":[]}">

Trending in Formulas and Functions