Dynamic lookups and counts

Lee8800

Board Regular
Joined
Aug 10, 2014
Messages
55
Hi All,

This has me stuck!

I need a formula that will count the number of a certain value ("P") based on a value (the Item) in the same row and between a set of dates.

A version of my data is below.

I will have a second table with each Item, and next to it the count of Ps (or another value). The formula needs to be able to accept an input of the item, and have a variable set of dates so that the parameters "Item 1", "03/07/2018", "05/07/2018" and "P" should return the value of 3 (the number of Ps for Item 1 between 3rd and 5th of July)

Item01/07/201802/07/201803/07/201804/07/201805/07/201806/07/2018
Item 1PPPPP
Item 2PPPPP
Item 3PPPPP

<tbody>
</tbody>


Any help would be greatly appreciated!!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Maybe something like this

A
B
C
D
E
F
G
H
I
J
K
L
1
Item​
01/07/2018​
02/07/2018​
03/07/2018​
04/07/2018​
05/07/2018​
06/07/2018​
Item​
Begin​
End​
Result​
2
Item 1​
P​
P​
P​
P​
P​
Item 1​
03/07/2018​
05/07/2018​
3​
3
Item 2​
P​
P​
P​
P​
Item 3​
03/07/2018​
05/07/2018​
1​
4
Item 3​
P​
P​
P​

Criteria in columns I:K

Formula in L2 copied down
=COUNTIFS($B$1:$G$1,">="&J2,$B$1:$G$1,"<="&K2,INDEX($B$2:$G$4,MATCH(I2,$A$2:$A$4,0),0),"P")

Hope this helps

M.
 
Upvote 0
Perfect Thanks!!!

Much simpler than I thought, kicking myself now...... I can easily adapt to my additional needs!!!! Thanks again!
 
Upvote 0

Forum statistics

Threads
1,215,457
Messages
6,124,941
Members
449,198
Latest member
MhammadishaqKhan

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