Want to flag overlapping dates AND times

Based on information I've found here, I've created a formula that identifies overlapping times that occur on the same day, but I'd like to adapt it to incorporate items that occur over multiple days. This will be used for booking of equipment.

Here is what I have so far:

=IF(COUNTIFS(SAP:SAP,[email protected], [Start Date]:[Start Date], [Start Date]@row, [End Time]:[End Time], @cell >= [Start Time]@row, [Start Time]:[Start Time], @cell <= [End Time]@row) > 1, "No", "Yes")

"SAP" is the reference to the instrument. I'd like to add "End Date" to the formula. In the snip below, rows 1 & 2 should also be "no".

Thank you in advance!


image.png


Tags:

Best Answer

  • Hollie Green
    Hollie Green ✭✭✭✭✭
    Answer ✓

    Ok I think I got it. It's due to the times you need to combine the dates and times to get it to consider both as a whole and not individually. So you will need a helper column for your start date/time and end date time. I titled mine as Start Date Time Helper and End Date Time Helper. If you title them the same you should be able to copy and paste formulas.

    Start Date Time Helper

    =IFERROR(VALUE(YEAR(DATEONLY([Start Date]@row)) + "" + IF(MONTH(DATEONLY([Start Date]@row)) < 10, "0") + MONTH(DATEONLY([Start Date]@row)) + IF(DAY(DATEONLY([Start Date]@row)) < 10, "0") + DAY(DATEONLY([Start Date]@row)) + IF([Start Time]@row < 1000, "0") + [Start Time]@row), "")

    End Date Time Helper

    =IFERROR(VALUE(YEAR(DATEONLY([End Date]@row)) + "" + IF(MONTH(DATEONLY([End Date]@row)) < 10, "0") + MONTH(DATEONLY([End Date]@row)) + IF(DAY(DATEONLY([End Date]@row)) < 10, "0") + DAY(DATEONLY([End Date]@row)) + IF([End Time]@row < 1000, "0") + [End Time]@row), "")

    Formula to get your Yes/No's

    =IF(COUNTIFS(SAP:SAP,[email protected], [End Date Time Helper]:[End Date Time Helper], @cell >= [Start Date Time Helper]@row, [Start Date Time Helper]:[Start Date Time Helper], @cell <= [End Date Time Helper]@row) > 1, "No", "Yes")

Answers

  • Hollie Green
    Hollie Green ✭✭✭✭✭

    I think the issue may be [Start Date]:[Start Date], [Start Date]@row I think it needs to be [Start Date]:[Start Date], @cell>=[Start Date]@row or it will only count the Start date that is matching that start date exactly so it isn't count the cell that starts on June 14th as overlapping with the first one.

  • Michelle T
    edited 06/19/23

    @Hollie GreenThe first two rows are now correctly flagged, but unfortunately other rows that should be OK are flagged as not OK (line 3 should be OK):

    image.png


  • Hollie Green
    Hollie Green ✭✭✭✭✭
    Answer ✓

    Ok I think I got it. It's due to the times you need to combine the dates and times to get it to consider both as a whole and not individually. So you will need a helper column for your start date/time and end date time. I titled mine as Start Date Time Helper and End Date Time Helper. If you title them the same you should be able to copy and paste formulas.

    Start Date Time Helper

    =IFERROR(VALUE(YEAR(DATEONLY([Start Date]@row)) + "" + IF(MONTH(DATEONLY([Start Date]@row)) < 10, "0") + MONTH(DATEONLY([Start Date]@row)) + IF(DAY(DATEONLY([Start Date]@row)) < 10, "0") + DAY(DATEONLY([Start Date]@row)) + IF([Start Time]@row < 1000, "0") + [Start Time]@row), "")

    End Date Time Helper

    =IFERROR(VALUE(YEAR(DATEONLY([End Date]@row)) + "" + IF(MONTH(DATEONLY([End Date]@row)) < 10, "0") + MONTH(DATEONLY([End Date]@row)) + IF(DAY(DATEONLY([End Date]@row)) < 10, "0") + DAY(DATEONLY([End Date]@row)) + IF([End Time]@row < 1000, "0") + [End Time]@row), "")

    Formula to get your Yes/No's

    =IF(COUNTIFS(SAP:SAP,[email protected], [End Date Time Helper]:[End Date Time Helper], @cell >= [Start Date Time Helper]@row, [Start Date Time Helper]:[Start Date Time Helper], @cell <= [End Date Time Helper]@row) > 1, "No", "Yes")

  • @Hollie GreenThat did the trick, thank you so much!!!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the公式手册模板!
Hi @mromaire<\/a>,<\/p>

Try this!<\/p>

=IF(RIGHT([xfmr#]@row, 1) = \"X\", \"277\/480\", IF(RIGHT([xfmr#]@row, 1) = \"E\", \"120\/208\", \"120\/240\"))<\/p>

Hope that helps!<\/p>

BRgds,<\/p>

-Ray<\/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":106771,"type":"question","name":"SUMIFS Formula for Column with Various Possible Returns","excerpt":"Hi there! I am a big Excel user switching to Smartsheet and need help with a SUMIFS formula. In Excel, the formula was: =SUM(SUMIFS('Outside Counsel Invoices'!$G:$G,'Outside Counsel Invoices'!$M:$M,\"FY23\",'Outside Counsel Invoices'!$D:$D,{\"=7607\",\"=7607*\"})) Since Wildcards (*) are not used in Smartsheet, I am struggling…","categoryID":322,"dateInserted":"2023-06-22T14:38:12+00:00","dateUpdated":null,"dateLastComment":"2023-06-22T18:01:43+00:00","insertUserID":162633,"insertUser":{"userID":162633,"name":"BuckeyeGirl72","url":"https:\/\/community.smartsheet.com\/profile\/BuckeyeGirl72","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-22T18:38:12+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":162633,"lastUser":{"userID":162633,"name":"BuckeyeGirl72","url":"https:\/\/community.smartsheet.com\/profile\/BuckeyeGirl72","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-22T18:38:12+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":4,"countViews":22,"score":null,"hot":3374903995,"url":"https:\/\/community.smartsheet.com\/discussion\/106771\/sumifs-formula-for-column-with-various-possible-returns","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/106771\/sumifs-formula-for-column-with-various-possible-returns","format":"Rich","lastPost":{"discussionID":106771,"commentID":381811,"name":"Re: SUMIFS Formula for Column with Various Possible Returns","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/381811#Comment_381811","dateInserted":"2023-06-22T18:01:43+00:00","insertUserID":162633,"insertUser":{"userID":162633,"name":"BuckeyeGirl72","url":"https:\/\/community.smartsheet.com\/profile\/BuckeyeGirl72","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-22T18:38:12+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":"2023-06-22T18:38:09+00:00","dateAnswered":"2023-06-22T17:53:03+00:00","acceptedAnswers":[{"commentID":381809,"body":"

It looks like you have a mix of text strings and numerical values. Try the below. If that doesn't work then we do have one more option.<\/p>

SUMIFS({Range To Sum}, {Range To Evaluate}, OR(@cell = 7607, CONTAINS(\"7607\", @cell)))<\/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":106733,"type":"question","name":"Automated email to assigned people on a spreadsheet for updates","excerpt":"I have a sheet that has multiple lines assigned to different people. I'd like to send an automated email 14 days prior to an event day to update all the lines that are assigned to them. I dont want to use the Request an update workflow because it does it like a form and I really need it to be in a spreadsheet. Is it…","categoryID":322,"dateInserted":"2023-06-21T20:33:52+00:00","dateUpdated":null,"dateLastComment":"2023-06-22T16:22:42+00:00","insertUserID":159884,"insertUser":{"userID":159884,"name":"Connie Cochran","url":"https:\/\/community.smartsheet.com\/profile\/Connie%20Cochran","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-22T16:18:45+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-06-22T17:53:12+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":6,"countViews":37,"score":null,"hot":3374834194,"url":"https:\/\/community.smartsheet.com\/discussion\/106733\/automated-email-to-assigned-people-on-a-spreadsheet-for-updates","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/106733\/automated-email-to-assigned-people-on-a-spreadsheet-for-updates","format":"Rich","lastPost":{"discussionID":106733,"commentID":381773,"name":"Re: Automated email to assigned people on a spreadsheet for updates","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/381773#Comment_381773","dateInserted":"2023-06-22T16:22:42+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-06-22T17:53:12+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":"2023-06-22T16:18:59+00:00","dateAnswered":"2023-06-22T16:14:09+00:00","acceptedAnswers":[{"commentID":381766,"body":"

The alert will only send them rows that they are listed as assigned to. The entire sheet will not be shown in the email.<\/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":[]}],"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