counting characters and sumif

Becky Lindholm

New Member
Joined
Sep 14, 2005
Messages
17
LYNA-Z $412,458.72
SBC $54,411.90
BP $55,971.50
NWL $52,095.00
LNT $58,260.00
MEL $62,021.80
XOM $65,446.20
USB $58,968.00
MMM $96,836.54

I need to write a formula that will see how many characters are in each cell of the first column. If there are 1, 2 or 3 characters it will sum the corresponding value. If there are more than three characters I don't want the corresponding value included in the sum. I would appreciate any assistance. Thanks!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Becky Lindholm said:
LYNA-Z $412,458.72
SBC $54,411.90
BP $55,971.50
NWL $52,095.00
LNT $58,260.00
MEL $62,021.80
XOM $65,446.20
USB $58,968.00
MMM $96,836.54

I need to write a formula that will see how many characters are in each cell of the first column. If there are 1, 2 or 3 characters it will sum the corresponding value. If there are more than three characters I don't want the corresponding value included in the sum. I would appreciate any assistance. Thanks!

1.

=SUM(SUMIF(A2:A10,{"?","??","???"},B2:B10))

2.

=SUMPRODUCT(--(A2:A10<>""),--(LEN(A2:A10)<=3),B2:B10)
 
Upvote 0

Forum statistics

Threads
1,224,884
Messages
6,181,558
Members
453,053
Latest member
Kiranm13

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