sum if string is a certain length?

K

Kris Eiben

I'm using Excel 2000. I would like to sum up a column, taking only
those rows that have a certain-length string in another column. Kinda
like SUMIF, but with a len() function thrown into the mix. Possible?
How?

Background: we are looking at a new data source that some of our
customers use. Haven't found any real documentation on the data (column
descriptions would be so helpful), or anyone who can explain it all to
us. So, we're analyzing the data, trying to add up the numbers the same
way our customers do -- and no, they really can't tell us exactly how
they do it, since they only use a reporting tool that hides the queries
and raw data from them. There's one column that seems to be
multi-use -- sometimes it holds a 5-char code, other times it's a
12-char code. I'd like to see if eliminating the 12-char-code lines
gets me results closer to what the customers are expecting. Since the
data changes continuously, and I need to pull a new Excel sheet every
time I grab a snapshot of the data, I'm trying to avoid adding a column
(like a column that calculates the length). But if I must, I must.
 
B

Bob Phillips

Kris,

=SUMPRODUCT((A1:A1000)*(LEN(B1:B1000)=5))

should do it, change the ranges to suit
 
J

Jason Morin

=SUMPRODUCT((LEN(A1:A20)=3)*B1:B20)

Translated: Sum B1:B20 where the char. length is 3 in the
range A1:A20.

HTH
Jason
Atlanta, GA
 
K

Kris Eiben

Thanks, you guys rock!

Jason Morin said:
=SUMPRODUCT((LEN(A1:A20)=3)*B1:B20)

Translated: Sum B1:B20 where the char. length is 3 in the
range A1:A20.

HTH
Jason
Atlanta, GA
 

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