Count multiple criteria

Mike30

New Member
Joined
Apr 18, 2018
Messages
5
Hello All,

I am hoping someone can help, I have a table on worksheet 1 that contains my data and I am trying to do a front page (totals) on a different worksheet. I am trying to look up and count certain criteria and I can't get it to work.. eg.. worksheet 1 has the below table in and in the worksheet 2 I am trying to count that if Product (column A) = bar then i am trying to count how many are 1-2 weeks, 3-4 weeks etc..
Worksheet 1
[TABLE="width: 500"]
<tbody>[TR]
[TD]product-[/TD]
[TD]14/04[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]bar[/TD]
[TD]<2weeks[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]bar[/TD]
[TD]<2weeks[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]bar[/TD]
[TD]<1week[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]bar[/TD]
[TD]<3weeks[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]bar[/TD]
[TD]<2weeks[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]drink[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Worksheet 2
[TABLE="width: 500"]
<tbody>[TR]
[TD]product[/TD]
[TD]min(<1Week & <2weeks)[/TD]
[TD]mid (<3weeks & 4weeks)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]bar[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]crisp[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]can[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Hope this makes sense
Mike
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
No cell references so I will assume that Product is in A1 in both sheets

in Sheet2!B2
=SUMPRODUCT(--(Sheet1!$A$2:$A$1000=A2)*((Sheet1!$B$2:$B$1000="<1Week")+(Sheet1!$B$2:$B$1000="<2Weeks")))
and copy down

in Sheet2!C2
=SUMPRODUCT(--(Sheet1!$A$2:$A$1000=A2)*((Sheet1!$B$2:$B$1000="<3Weeks")+(Sheet1!$B$2:$B$1000="<4Weeks")))
and copy down
 
Upvote 0
Another quick question, if column b is black but has a formula in the cell how to i count the entire column but ignore the formula?
Thanks
Mike
 
Upvote 0
Black or blank ? Blank I presume

I dont know a way of counting cells that do not have a formula.
 
Upvote 0
COUNTA counts non blank cells.

If column D is empty apart from D2 and D4 and D2 is 3 and D4 is blank (but is the result of a formula) then COUNTA(D1:D10) will be 2.
So it's counting D2 and D4 (even though D4 is blank).

So if you wanted to count cells that don't contain a formula or a result just subtract the result from the range of cells, ie 10-COUNTA(D1:D10) = 8

So COUNTA will count non blank cells even if the result is blank but it wont distinguish between a cell that contains a value or a cell that contains a formula. Both will be counted with COUNTA.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,747
Messages
6,180,712
Members
452,995
Latest member
isldboy

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