multicondition summing/counting using cell references

benhmckelvey

New Member
Joined
Oct 22, 2008
Messages
7
I would like to COUNT (could be SUM) the number of instances where column A = $D$1 while column B = $E$1. So going by the table below the answer should be 3. I found I can do it when I insert "D-2" into a SUMPRODUCT formula but not when I refer to cell $D$1. If I can help it I would like to refrain from using a helper column. Any ideas guys? Cheers Ben

<table style="border-collapse: collapse; width: 269pt;" width="358" border="0" cellpadding="0" cellspacing="0"><col style="width: 29pt;" width="38"> <col style="width: 48pt;" span="5" width="64"> <tbody><tr style="height: 15pt;" height="20"> <td class="xl67" style="height: 15pt; width: 29pt;" width="38" height="20">
</td> <td class="xl68" style="width: 48pt;" width="64">A</td> <td class="xl68" style="width: 48pt;" width="64">B</td> <td class="xl68" style="width: 48pt;" width="64">C</td> <td class="xl68" style="width: 48pt;" width="64">D</td> <td class="xl68" style="width: 48pt;" width="64">E</td> </tr> <tr style="height: 15pt;" height="20"> <td class="xl69" style="height: 15pt;" height="20">1</td> <td>D-2</td> <td class="xl66">D-2</td> <td>
</td> <td>D-2</td> <td>D-3</td> </tr> <tr style="height: 15pt;" height="20"> <td class="xl69" style="height: 15pt;" height="20">2</td> <td>D-2</td> <td class="xl66">D-3</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 15pt;" height="20"> <td class="xl69" style="height: 15pt;" height="20">3</td> <td>D-2</td> <td class="xl66">D-4</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 15pt;" height="20"> <td class="xl69" style="height: 15pt;" height="20">4</td> <td>D-2</td> <td class="xl66">D-3</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 15pt;" height="20"> <td class="xl69" style="height: 15pt;" height="20">5</td> <td>D-2</td> <td class="xl66">D-4</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 15pt;" height="20"> <td class="xl69" style="height: 15pt;" height="20">6</td> <td>D-2</td> <td class="xl66">D-3</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 15pt;" height="20"> <td class="xl69" style="height: 15pt;" height="20">7</td> <td class="xl66">D-3</td> <td class="xl66">D-4</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 15pt;" height="20"> <td class="xl69" style="height: 15pt;" height="20">8</td> <td class="xl66">D-3</td> <td class="xl66">D-3</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 15pt;" height="20"> <td class="xl69" style="height: 15pt;" height="20">9</td> <td class="xl66">D-3</td> <td class="xl66">D-2</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 15pt;" height="20"> <td class="xl69" style="height: 15pt;" height="20">10</td> <td class="xl66">D-3</td> <td class="xl66">D-2</td> <td>
</td> <td>
</td> <td>
</td> </tr> <tr style="height: 15pt;" height="20"> <td class="xl69" style="height: 15pt;" height="20">11</td> <td class="xl66">D-3</td> <td class="xl66">D-4</td> <td>
</td> <td>
</td> <td>
</td> </tr> </tbody></table>
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
You might want to post the formula you tried Ben, because I can't see why

=SUMPRODUCT(--($A$1:$A$11=$D$1),--($B$1:$B$11=$E$11))

wouldn't work.
 
Upvote 0
Thanks Adam

The 2 formulas I was using was

=SUMPRODUCT(($A:$A=$D$1)*($B:$B=$E$1))
and
{=SUM(($A:$A=$D$1)*($B:$B=$E$1))}

Where the 2nd formula would work but it was hard-coated in.

I haven't used the double negative before but it works a treat
 
Upvote 0
No problem Ben.

I just wonder if you're using pre-Excel 2007, in which case whole columns do not work with SUMPRODUCT (I think).

Cheers
Adam
 
Upvote 0
"...(I think)..."

You are correct. Best to only calculate over the data that's actually being used.
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,312
Members
448,564
Latest member
ED38

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