Counting a Table Contents

Steve 1962

Active Member
Joined
Jan 3, 2006
Messages
351
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

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.
How about
+Fluff New.xlsm
ABCDEFGHIJ
1DateReferenceStartEndReference567111234678
201/04/2020567CairoNew YorkAllowed LocationsBostonCairoBostonAuckland
301/04/2020567BostonNew YorkNew YorkAucklandNew YorkLas Vegas
401/04/2020567BostonNew YorkCalgaryNew YorkCairoLos Angeles
501/04/2020111DallasBoston
601/04/2020567BostonCalgary
702/04/2020234BostonCairo
802/04/2020234Los AngelesBoston01/04/20201100
902/04/2020567BostonBoston02/04/20200110
1002/04/2020567BostonNew York03/04/20200203
1102/04/2020111BostonNew York04/04/20200020
1202/04/2020567BostonNew York
1303/04/2020111New YorkNew York
1403/04/2020111New YorkLos Angeles
1503/04/2020111Las VegasNew York
1603/04/2020678New YorkCairo
1703/04/2020678New YorkCairo
1803/04/2020678SeattleCairo
1904/04/2020111New YorkCairo
2004/04/2020111New YorkCairo
2104/04/2020567New YorkBoston
2204/04/2020234AucklandBoston
2304/04/2020234CairoBoston
2404/04/2020234AucklandBoston
Report
Cell Formulas
RangeFormula
F8:F11F8=UNIQUE(A2:A24)
G8:J11G8=COUNT(FILTER(ROW($A$2:$A$24),($A$2:$A$24=$F8)*($B$2:$B$24=G$1)*((ISERROR(MATCH($C$2:$C$24,G$2:G$4,0)))+(ISERROR(MATCH($D$2:$D$24,G$2:G$4,0))))))
Dynamic array formulas.
 
Upvote 0
Hey thanks Fluff -

I don't have the UNIQUE function in my version of Excel. I might be able to find some way around this.

Is there an equivalent function in earlier versions (2013) ?

Thanks
 
Upvote 0
Unfortunately, that was the only way I could find, hopefully somebody else will step in.
 
Upvote 0
Not sure if it helps but I don't need formuals for dates in cells F8 to F11. They will be hard coded in the cells.
 
Upvote 0
Refer enclosed image - Enter below formula as an Array formula (Ctrl+Shift+Enter) in cell G8 and copy to the right and down:

=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))
 

Attachments

  • MultiColumnRow_Frequency_Match.gif
    MultiColumnRow_Frequency_Match.gif
    64.9 KB · Views: 8
Upvote 0
It appears from above that it is working however, I seem to getting a different answer my end.

See below -

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

Forum statistics

Threads
1,215,634
Messages
6,125,934
Members
449,275
Latest member
jacob_mcbride

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