SUMPRODUCT using SEARCH with numbers and strings

R0GU3

New Member
Joined
Aug 4, 2017
Messages
16
I have data in cells that are number values and string values. The String values are #_ # with the # being any number. Example:
3
2
1_4
3
4
2_10

<tbody>
</tbody>

I want to SUM (3,1,4) and (2,3,2)

Here is what I have (Using Ctrl+Shift+Enter):
Code:
=SUMPRODUCT((LEFT(IF(ISTEXT(L31:L38), L31:L38, 0),IFERROR(SEARCH("_",L31:L38),0))-1))
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Try must use Ctrl+Shift+Enter
Code:
=SUM(IFERROR(LEFT(L31:L33,SEARCH("_",L31:L33)-1)+0,L31:L33))
 
Upvote 0
left and search give a text as result
use VALUE to convert to a number
 
Upvote 0
Rich (BB code):
=sumproduct(if(isnumber(l31:l38),l31:l38;value(left(l31:l38,search("_",l31:l38)-1))))
 
Upvote 0

Unknown
ABC
132
21_43
342_10
4
5Sum87
Sheet6
Cell Formulas
RangeFormula
B5=SUMPRODUCT(REPLACE(B1:B3,FIND("_",B1:B3&"_"),255,"")+0)
 
Last edited:
Upvote 0
Or,


Unknown
ABC
132
21_43
342_10
4
5Sum87
Sheet6
Cell Formulas
RangeFormula
B5=SUMPRODUCT(INT(SUBSTITUTE(B1:B3,"_",".")+0))
 
Last edited:
Upvote 0
Or,

Unknown
ABC
132
21_43
342_10
4
5Sum87

<colgroup><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet6

Worksheet Formulas
CellFormula
B5=SUMPRODUCT(INT(SUBSTITUTE(B1:B3,"_",".")+0))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

All of your suggestions worked! This seemed to be the most simplest way to accomplish what I was going for. Didn't even think about making it a decimal number and just pulling the integer. This avoids using the function as an array too!

Thanks to all who responded.
 
Upvote 0

Forum statistics

Threads
1,216,575
Messages
6,131,501
Members
449,654
Latest member
andz

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