Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default count if matching text

I'm trying to put together a formula that will count the number of times the
data in column a matches c.
I need a total column in this case(row 6) should say 2 because text in
columns a & c only match 3 times

Say i have:
a b c d e
1 c1 c1
2 c2 c1
3 f3 f3
4 p2 f3
5 t4 t4
6
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default count if matching text

I don't understand the logic of displaying 2 when there are 3 direct
matches (c1/c1, f3/f3 and t4/t4).

Please explain.

Pete

On Jan 24, 12:20*am, Araseli
wrote:
I'm trying to put together a formula that will count the number of times the
data in column a matches c.
I need a total column in this case(row 6) should say 2 because text in
columns a & c only match 3 times

Say i have:
* *a * b * c * d * e
1 c1 * * *c1
2 c2 * * *c1 *
3 f3 * * * f3
4 p2 * * *f3
5 t4 * * *t4
6


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default count if matching text

Each row has to match to be counted, right?

=SUMPRODUCT(--(A1:A5=B1:B5))

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html

Araseli wrote:

I'm trying to put together a formula that will count the number of times the
data in column a matches c.
I need a total column in this case(row 6) should say 2 because text in
columns a & c only match 3 times

Say i have:
a b c d e
1 c1 c1
2 c2 c1
3 f3 f3
4 p2 f3
5 t4 t4
6


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default count if matching text

Hi,

If they are only counted as matches if they are on the same row then

=SUM(N(A1:A5=B1:B5))

Entered as an array (press Shift+Ctrl+Enter to enter the formula)

If the matches are case sensitive (A2 is not equal to a2) then

=SUMPRODUCT(1*EXACT(A1:A5,B1:B5))
or
=SUMPRODUCT(--EXACT(A1:A5,B1:B5))

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Araseli" wrote:

I'm trying to put together a formula that will count the number of times the
data in column a matches c.
I need a total column in this case(row 6) should say 2 because text in
columns a & c only match 3 times

Say i have:
a b c d e
1 c1 c1
2 c2 c1
3 f3 f3
4 p2 f3
5 t4 t4
6

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default count if matching text

I am so sorry it should have said 3 instead of 2.. but someone else already
gave me an answer.
Thanks you for time!

"Pete_UK" wrote:

I don't understand the logic of displaying 2 when there are 3 direct
matches (c1/c1, f3/f3 and t4/t4).

Please explain.

Pete

On Jan 24, 12:20 am, Araseli
wrote:
I'm trying to put together a formula that will count the number of times the
data in column a matches c.
I need a total column in this case(row 6) should say 2 because text in
columns a & c only match 3 times

Say i have:
a b c d e
1 c1 c1
2 c2 c1
3 f3 f3
4 p2 f3
5 t4 t4
6





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default count if matching text

Thank you so much!
it worked!

"Dave Peterson" wrote:

Each row has to match to be counted, right?

=SUMPRODUCT(--(A1:A5=B1:B5))

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html

Araseli wrote:

I'm trying to put together a formula that will count the number of times the
data in column a matches c.
I need a total column in this case(row 6) should say 2 because text in
columns a & c only match 3 times

Say i have:
a b c d e
1 c1 c1
2 c2 c1
3 f3 f3
4 p2 f3
5 t4 t4
6


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default count if matching text

Thank you so much for your time!

"Shane Devenshire" wrote:

Hi,

If they are only counted as matches if they are on the same row then

=SUM(N(A1:A5=B1:B5))

Entered as an array (press Shift+Ctrl+Enter to enter the formula)

If the matches are case sensitive (A2 is not equal to a2) then

=SUMPRODUCT(1*EXACT(A1:A5,B1:B5))
or
=SUMPRODUCT(--EXACT(A1:A5,B1:B5))

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Araseli" wrote:

I'm trying to put together a formula that will count the number of times the
data in column a matches c.
I need a total column in this case(row 6) should say 2 because text in
columns a & c only match 3 times

Say i have:
a b c d e
1 c1 c1
2 c2 c1
3 f3 f3
4 p2 f3
5 t4 t4
6

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
count number of rows with 2 matching text cells smcmoran Excel Worksheet Functions 5 September 29th 08 05:53 PM
Count matching text in column Tom Excel Discussion (Misc queries) 1 September 29th 07 09:08 AM
Count matching text in two columns Bob Phillips Excel Discussion (Misc queries) 2 July 4th 07 12:00 PM
Help with Matching Text Fields - Then Moving the Matching Cells Side by Side [email protected] Excel Discussion (Misc queries) 2 June 11th 07 02:38 PM
How to count matching text Duplicateman Excel Discussion (Misc queries) 6 November 26th 04 08:40 AM


All times are GMT +1. The time now is 09:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"