sum if string is a certain length?

  • Thread starter Thread starter Kris Eiben
  • Start date Start date
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.
 
Kris,

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

should do it, change the ranges to suit
 
=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
 
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
 
Back
Top