Sum Up Cells That Contain The Letter "D" - Not SUMIF

fun2excel4money

New Member
Joined
Dec 24, 2016
Messages
18
Hello All,

I have a simple data set with two columns shown below. The first column contains an amount. The second column has a corresponding value that can either be "D", "R", "S", or any combination of the three letters. I am looking for a formula that can sum up the values where the second column contains a "D". I am trying to avoid CSE.


<style><!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";}@page {margin:1.0in .75in 1.0in .75in; mso-header-margin:.5in; mso-footer-margin:.5in;}td {padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:black; font-size:12.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Calibri, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;}--></style>[TABLE="class: grid, width: 130"]
<!--StartFragment--> <colgroup><col width="65" span="2" style="width:65pt"> </colgroup><tbody>[TR]
[TD="width: 65, align: right"]1[/TD]
[TD="width: 65"]D[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD]S[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD]S[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD]SD[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD]DSR[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD]R[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD]R[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD]DSR[/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD]S[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD]R[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD]S[/TD]
[/TR]
<!--EndFragment--></tbody>[/TABLE]

Based on a regular sum, the total should be 67. I am currently using this formula: <style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Lucida Grande'; color: #000000}</style>SUMPRODUCT((IFERROR(IF(SEARCH("d",B1:B17)>0,1,0),0)*A1:A17). This provides me a number of 153. If I use CSE, the amount populates to 67. I believe I have to use CSE because of the array in the search. If there is a similar solution without the use of CSE, I would love to know. Thank you very much in advance for your help!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Why does SUMIF not work (see below)?


Excel 2010
ABCD
11D67
22D
33D
44D
55D
66D
77S
88S
99SD
1010DSR
1111R
1212R
1313DSR
1414D
1515S
1616R
1717S
Sheet3
Cell Formulas
RangeFormula
D1=SUMIF(B1:B17,"*D*",A1:A17)
 
Last edited:
Upvote 0
Hi,

Modified SUMPRODUCT formula:


Book1
ABCD
11D67
22D
33D
44D
55D
66D
77S
88S
99SD
1010DSR
1111R
1212R
1313DSR
1414D
1515S
1616R
1717S
Sheet36
Cell Formulas
RangeFormula
D1=SUMPRODUCT((ISNUMBER(SEARCH("D",B1:B17))*A1:A17))
 
Upvote 0
You're welcome, thought you had some kind of reason for not using SUMIF since you had it in the thread Title. Mark's SUMIF is better than using SUMPRODUCT.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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