Using IF, COUNTIFS, and HAS functions to locate double booked equipment
Hello!
I am using this formula in a checkbox "helper"
column. =IF(COUNTIFS(Resources:Resources, HAS(@cell, "Gray Van"), [Start Date]:[Start Date], @cell <= [End Date]@row, [End Date]:[End Date], @cell >= [Start Date]@row) > 1, 1)
My hope would be if a piece of equipment is selected in the Resources (dropdown) column in two different rows AND the Start Date and End Date of those rows overlap it checks the box to notify of an overlapped booking.
Currently, it doesn't check the box for the right row when there is an overlap. Can anyone help me find out what I am doing wrong?
Thanks in advance!
Answers
-
Hi @hockenberry2d, does this work?
=IF(COUNTIFS(Resources:Resources, Resources@row, Resources:Resources, <>"", [Start Date]:[Start Date], <=[End Date]@row, [End Date]:[End Date], >=[Start Date]@row)>1,1, 0)
-
Hi @Lucas Rayala, sort of. So the problem is if I have Gray Van and Tilt Trailer selected in that row it won't check the box unless another row has exactly Gray Van and Tilt Trailer. I need it to check the box if EITHER the Gray Van OR Tilt Trailer are in another row that have dates that overlap.
Hopefully that makes sense.
-
Hi @hockenberry2d, I updated this to give a slightly more compact solution (originally I added in some helper columns which aren't going to buy you much). It's kind of an ungainly problem in almost any environment. These are nested IF statements, I used "Gray Van" and "Tilt Trailer" as examples. You need to repeat these if statements for each resource type. Your cell can only contain 4000 characters, so that's your limit.
=IF(AND(CONTAINS("Gray Van",Resources@row), COUNTIFS(Resources:Resources, Resources@row, Resources:Resources, CONTAINS("Gray Van", @cell), [Start Date]:[Start Date], <=[End Date]@row, [End Date]:[End Date], >=[Start Date]@row))>1,1,
IF(AND(CONTAINS("Tilt Trailer",Resources@row), COUNTIFS(Resources:Resources, Resources@row, Resources:Resources, CONTAINS("Tilt Trailer", @cell), [Start Date]:[Start Date], <=[End Date]@row, [End Date]:[End Date], >=[Start Date]@row))>1,1,
0)
Just keep adding the statements and updating the resource name. The last "IF" statement ends with a "0". Then add end parenthesis until the formulas says you're good. I would create this in a Notepad (or in this case Word would work, because there's no quotes, but generally Word changes the quotes so they can't be read by Smartsheets).
Feasible?
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!