Excel Query date range for Value

compguy101101

Trying to query an excel document to determine the number of times a value appears so I can put in conditional formatting on and heat map to determine the number of times the resource is busy during a date.

I have Jan1-Dec31 in individual cells I need to query data split among three colums as follows

       A       B       C
      Jan1    Jan12   Bob
      Jan2    Jan10   Roger
      Jan11   Jan14   Bob

The formula needs to use the start date in column A and end date in column B and count the resource name occurrence in column C.

So my output would go into my Heat Map as follows.

        Bob  Roger
 Jan1    1    0

 Jan2    1    1

 Jan3    1    1

 Jan4    1    1

 Jan5    1    1

 Jan6    1    1

 Jan7    1    1

 Jan8    1    1

 Jan9    1    1

 Jan10   1    1

 Jan11   2    0

 Jan12   2    0

 Jan13   1    0

 Jan14   1    0

If if could expanded without having to make 365 formulas for each resource that would be great.

Joe

I think I'm understanding your question properly. The way I'm interpreting it is that you're looking for a way to expand your "heat map" input, but I may be reading it wrong. Let me know if I'm mistaken.

This is a classic case of where SUMPRODUCT is awesome.

=SUMPRODUCT(--($E2>=$A$2:$A$4)*($E2<=$B$2:$B$4)*(F$1=$C$2:$C$4))

Which you can copy over and down (see image). You'll obviously need to edit your ranges accordingly to fit your real data.

It works like this. Consider Bob's 1/1/2016. It takes the date and compares the date to the start date, and creates an array of true/false based on whether or not the date is greater than or equal to the start dates in the start date array. Then it does the same, less than or equal to the end dates in the end date array. Then it checks the resource array for Bobs. At the end, you have three arrays:

{TRUE, FALSE, FALSE} * {TRUE, TRUE, TRUE} * {TRUE, FALSE, TRUE} -> {TRUE, FALSE, FALSE}. The * is an AND operator, so any place where TRUE, TRUE, TRUE occurs is a 1 and if any FALSE occurs its a zero. Then, it coerces your TRUE, FALSE, FALSE array to 1, 0, 0 and sums the result!

enter image description here

Edit: Here's a way to tackle what we're talking about in the comments.

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related