Date ranges in formula

ShoYnn

Board Regular
Joined
Mar 20, 2019
Messages
60
Office Version
  1. 2016
Platform
  1. Windows
I have a sumproduct formula that I am trying to figure out. It is for conditional formatting to ensure the same person does not get scheduled for multiple jobs during the same date range. The formula is:

=sumproduct((start date<=range of end dates)*(end date>=range of start dates)*(name=range of names))>1

It works sometimes, but I did some researching and found something interesting. If you throw each individual part in its own formula you find some neat things. The (start date<=range of end dates) always returns a 0, or false. So I simplified it and made a cell that just had =(range of end dates) and it gave me January 0 1900. Does anyone know why excel does this, and maybe a work around for it? Thanks!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
What version f Excel are you suing?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Are you using actual ranges, or a named range? The fact that you get a 0 from =(range of end dates) would suggest blank cells
 
Upvote 0
I am not using a named range, just used words in this example to simplify some things, and I have Excel 2016. Thanks for fixing me on the Account details, I didn't even know that was a thing, but I totally get how helpful it is!

So yeah, I am using an actual range as it will get filled in as jobs come up. Would a dynamic named range for those 3 ranges fix everything?
 
Upvote 0
Thanks for updating your account.
Can you post the actual formula you are using.
 
Upvote 0
=Sumproduct((B$2<=$B$3:$BZ$3)*(B$3>=$B$2:$BZ$2)*(B4=$B$4:$B$11))>1

Where row 2 is the start date row, row 3 is the end date row, and rows 4 through 11 are the names. The jobs get built out sideways, and I used BZ as a generic end column since I was unsure of how many jobs would actually be added. I apologize that I can't get super fancy with these posts, I have to do them from my phone. The government computers don't like us going to forum sites, so I have to do all this from my phone
 
Upvote 0
I apologize that I can't get super fancy with these posts, I have to do them from my phone. The government computers don't like us going to forum sites, so I have to do all this from my phone
Not a problem, i fully understand. However I'm struggling to figure out what your data looks like based on that formula.
Is there any way you could upload a sanitised image?
 
Upvote 0
Thinking about it, is this the sort of thing you are trying to do.
+Fluff 1.xlsm
ABCDEFGHIJK
1
201/10/202107/10/202121/10/202128/10/2021
310/10/202115/10/202130/10/202105/11/2021
4ABAH
5CGCF
6FHGA
7H
8
9
10
11
Master
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B4:K11Expression=SUMPRODUCT((B$2<=$B$3:$K$3)*(B$3>=$B$2:$K$2)*(B4=$B$4:$K$11)*(B4<>""))>1textNO
 
Upvote 0
Solution
Absolutely yes! Sorry, was at lunch. So as mentioned above, this will continue to get built sideways and the jobs won't necessarily be in any specific date order, so a newly added job could happen before one of the previously added jobs. And the formula does work, but currently it only works because whatever the end date is is always higher than 0 as that is apparently what the start date range I have set calculates out to
 

Attachments

  • example.png
    example.png
    19.6 KB · Views: 5
Upvote 0
Have you tried the formula I suggested in post#7?
 
Upvote 0
I just did, and it seems to work about the same. I think dynamic ranges will be the way to go so that there wont be any blanks, the hard part will be getting a good dynamic range for the names as they wont always have the same amount of people assigned
 
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,980
Members
449,201
Latest member
Lunzwe73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top