Counting a Table Contents

Steve 1962

Active Member
Joined
Jan 3, 2006
Messages
349
Office Version
  1. 365
Platform
  1. Windows
Hi

I have a table that I want to summarise a count using certain criteria. That table is in cells F7 to J11.

The data that are being checked are in cells A1 to D24. I want the summary table noted above to check the date (column A), reference number column B), start & end (columns C & D) and only count if the locations found in the Start & End columns are not noted in the "Allowed Locations" which are identified in G1 to J4.

I have manually entered what the values should be in cells G8 to J11.

I have a feeling that it may be a MATCH / INDEX type solution but not sure. If there is an easier way, then all the better.

Thanks

Book1
ABCDEFGHIJ
1DateReferenceStartEndReference567111234678
21/04/2020567CairoNew YorkAllowed LocationsBostonCairoBostonAuckland
31/04/2020567BostonNew YorkNew YorkAucklandNew YorkLas Vegas
41/04/2020567BostonNew YorkCalgaryNew YorkCairoLos Angeles
51/04/2020111DallasBoston
61/04/2020567BostonCalgary
72/04/2020234BostonCairoShould Read - 567111234678
82/04/2020234Los AngelesBoston1/04/20201100
92/04/2020567BostonBoston2/04/20200110
102/04/2020567BostonNew York3/04/20200203
112/04/2020111BostonNew York4/04/20200020
122/04/2020567BostonNew York
133/04/2020111New YorkNew York
143/04/2020111New YorkLos Angeles
153/04/2020111Las VegasNew York
163/04/2020678New YorkCairo
173/04/2020678New YorkCairo
183/04/2020678SeattleCairo
194/04/2020111New YorkCairo
204/04/2020111New YorkCairo
214/04/2020567New YorkBoston
224/04/2020234AucklandBoston
234/04/2020234CairoBoston
244/04/2020234AucklandBoston
Sheet7
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
HI Amit

Tried again and have downloaded your file. Not sure why it is not working as the formulas are correct.


Book1
ABCDEFGHIJ
1DateReferenceStartEndReference567111234678
21/04/2020567CairoNew YorkAllowed LocationsBostonCairoBostonAuckland
31/04/2020567BostonNew YorkNew YorkAucklandNew YorkLas Vegas
41/04/2020567BostonNew YorkCalgaryNew YorkCairoLos Angeles
51/04/2020111DallasBoston
61/04/2020567BostonCalgary
72/04/2020234BostonCairoShould Read - 567111234678
82/04/2020234Los AngelesBoston1/04/20200000
92/04/2020567BostonBoston2/04/20200000
102/04/2020567BostonNew York3/04/20200000
112/04/2020111BostonNew York4/04/20200000
122/04/2020567BostonNew York
133/04/2020111New YorkNew York
143/04/2020111New YorkLos Angeles
153/04/2020111Las VegasNew York
163/04/2020678New YorkCairo
173/04/2020678New YorkCairo
183/04/2020678SeattleCairo
194/04/2020111New YorkCairo
204/04/2020111New YorkCairo
214/04/2020567New YorkBoston
224/04/2020234AucklandBoston
234/04/2020234CairoBoston
244/04/2020234AucklandBoston
Mr Excel
Cell Formulas
RangeFormula
G8:J11G8{=SUM(--(FREQUENCY(IF(ISNA(MATCH($C$2:$D$24,G$2:G$4,0))*ISNUMBER(MATCH($A$2:$A$24,$F8,0))*ISNUMBER(MATCH($B$2:$B$24,G$1,0)),ROW($A$2:$A$24)-ROW($A$2)+1,""),ROW($A$2:$A$24)-ROW($A$2)+1)>0))}
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Upvote 0
Did you put the formula in G8, confirm it with CSE & then drag down & across?
 
Upvote 0
But did you just put the formula in G8, or did you have G8:J11 selected when you entered the formula?
All your cells are looking at F8, which is wrong.
 
Upvote 0
Tried again. I think I have copied it correctly.



Book1
ABCDEFGHIJ
1DateReferenceStartEndReference567111234678
21/04/2020567CairoNew YorkAllowed LocationsBostonCairoBostonAuckland
31/04/2020567BostonNew YorkNew YorkAucklandNew YorkLas Vegas
41/04/2020567BostonNew YorkCalgaryNew YorkCairoLos Angeles
51/04/2020111DallasBoston
61/04/2020567BostonCalgary
72/04/2020234BostonCairoShould Read - 567111234678
82/04/2020234Los AngelesBoston1/04/20200000
92/04/2020567BostonBoston2/04/20200000
102/04/2020567BostonNew York3/04/20200000
112/04/2020111BostonNew York4/04/20200020
122/04/2020567BostonNew York
133/04/2020111New YorkNew York
143/04/2020111New YorkLos Angeles
153/04/2020111Las VegasNew York
163/04/2020678New YorkCairo
173/04/2020678New YorkCairo
183/04/2020678SeattleCairo
194/04/2020111New YorkCairo
204/04/2020111New YorkCairo
214/04/2020567New YorkBoston
224/04/2020234AucklandBoston
234/04/2020234CairoBoston
244/04/2020234AucklandBoston
Mr Excel
Cell Formulas
RangeFormula
G8:J11G8{=SUM(--(FREQUENCY(IF(ISNA(MATCH($C$2:$D$24,G$2:G$4,0))*ISNUMBER(MATCH($A$2:$A$24,$F8,0))*ISNUMBER(MATCH($B$2:$B$24,G$1,0)),ROW($A$2:$A$24)-ROW($A$2)+1,""),ROW($A$2:$A$24)-ROW($A$2)+1)>0))}
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Upvote 0
It works for me, check that you dates are real dates & not text.
 
Upvote 0
Yes, checked that the dates are real dates and they are.

I'll go through all the entries again as I don't know why I'm getting a different answer. Something is not right on my end but I don't know what it could be.
 
Upvote 0
Does the formula not show correct results when you download the excel file? Please download a fresh copy and check.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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