countif and sum if over a range.

G

Guest

Hello.

I was wondering if someone can help me with the countif and sum if
functions. I am trying to count how many entries contain the same first four
characters as another entry. So I want to do something like:

sum(if (left(c2:c500,4) = left(T2,4), 1, 0)

Obviously this doesn't work. Is there some way to look at the first four
chars of a range of cells? Is there some way to maybe use the find function
over a range?

Also, it gives a #value error if I just do:

sum( if (c2:c500 = left(T2,4), 1, 0)

How do I avoid this error?

I greatly appreciate any assistance you could provide.

Thanks,

-Michael
 
G

Guest

Hi,

Try one of the following formulas depending on what you want,

=SUMPRODUCT(--(LEFT(C2:C500,4)=T2))
=SUMPRODUCT(--(LEFT(C2:C500,4)=LEFT(T2,4)))

Regards,
B. R. Ramachandran
 
G

Guest

Great! Thank you so much for your help!

B. R.Ramachandran said:
Hi,

Try one of the following formulas depending on what you want,

=SUMPRODUCT(--(LEFT(C2:C500,4)=T2))
=SUMPRODUCT(--(LEFT(C2:C500,4)=LEFT(T2,4)))

Regards,
B. R. Ramachandran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top