Comparing Two Columns of Data

switty

New Member
Joined
Dec 15, 2002
Messages
9
I need to compare two columns of data. The first column will have names, A, B, C, D,.... and the second column will have yes, no, and blanks. I need to be able for a given value in the first column to be able to count the number of cells in the second column that are in the same row where the given value in the first column is that have either "yes" or "no" in one formula, then in a seperate formula count the blanks.

For Example<pre>
Column 1 Column 2
Bill Yes
Steve No
Bill Yes
Steve
Jim Yes
Bob No
Bill No
Bill
Steve No</pre>

Yes/No output for Bill=3
Blank output for Bill=1
Yes/No output for Steve=2
Blank output for Steve=1
....


It seems simple, but I cannot get past looking for "Bill" and if "Yes" in the second column then count. I can count one IF statement, but am not able to count a second IF statement.

Any help or hints appreciated!

Thanks,

Brian

EDIT: tags added
This message was edited by PaddyD on 2002-12-16 16:57
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
in general, multi condition counts can be done with sumproduct():

=sumproduct((range1=condition1)*(range2=condition2))

so:

=sumproduct((range1="Bill")*(range2={"Yes","No}))

and

=sumproduct((range1="Bill")*(len(range2)=0))

paddy
 
Upvote 0
Book9
ABCDEF
1nameY/NnameY/NBlank
2BillYesBill31
3SteveNoSteve21
4BillYesJim10
5SteveBob10
6JimYes
7BobNo
8BillNo
9Bill
10SteveNo
11
Sheet1


The formulas are...

E2:

=SUMPRODUCT(($A$2:$A$10=D2)*($B$2:$B$10={"Yes","No"}))

F2:

=SUMPRODUCT(($A$2:$A$10=D2)*(LEN($B$2:$B$10)=0))
 
Upvote 0
The PivotTable approach...
Book2
ABCDEFGHI
1NameYes/NoCountofNameYes/No2
2BillYesNameYes/No(blank)GrandTotal
3SteveNoBill314
4BillYesBob11
5SteveJim11
6JimYesSteve213
7BobNoGrandTotal729
8BillNo
9Bill
10SteveNo
11
12
Sheet1


Note: The "Yes" and "No" values have been Grouped into a new field, 'Yes/No2'.
 
Upvote 0
Thanks Everybody!!!! Worked perfectly!

I have found the new "Bible" for Excel formulas!!!!!

I will try to contribute to the cause if I can!

Brian
 
Upvote 0

Forum statistics

Threads
1,215,220
Messages
6,123,695
Members
449,117
Latest member
Aaagu

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