Sum of numbers with different prefix

foster5476

New Member
Joined
Jan 3, 2017
Messages
7
Hello,

New to the forum and have read thru the tips before posting and hope my chart was loaded correctly. I also search for an answer to my question but found nothing.

Well I work out of Autocad but my tables are imported data from excel spreadsheets.

So what I am trying to do is get the my table to get the sum of the numbers with the S- or B- in front of the number and disregard the -L after the number.

I am not able to remove the prefix or suffix on the numbers. So is there a way to get only the number sum in a function form? Basically giving me 24+25+143+144=336

Thanks I hope this made sense.


[TABLE="width: 206"]
<colgroup><col><col span="2"></colgroup><tbody>[TR]
[TD="colspan: 3"]LIST[/TD]
[/TR]
[TR]
[TD]QTY.[/TD]
[TD]MARK[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD]s-24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD]b-25[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD]s-143-L[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD]B-144-L[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="colspan: 2"]X[/TD]
[/TR]
[TR]
[TD="colspan: 3"]Other info for me[/TD]
[/TR]
[TR]
[TD="colspan: 3"]Other info for me[/TD]
[/TR]
[TR]
[TD="colspan: 3"]336 <--where I need the total [/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
This worked for your example given. Are there any instances where this will not work?


Excel 2010
AB
1LIST
2QTY.MARK
31s-24
41b-25
51s-143-L
61B-144-L
74X
8
9336
Sheet1
Cell Formulas
RangeFormula
A9{=SUM(IFERROR(SUBSTITUTE(MID(B3:B7,FIND("-",B3:B7)+1,LEN(B3:B7)),"-L","")+0,""))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Try the following array formula (to be entered using Ctrl+Shift+Enter, not just Enter):

=SUM(IFERROR(--MID(SUBSTITUTE(B3:B7,"-L",""),3,99),0))
 
Upvote 0
When I post it in my Autocadd I get ####

I tried in my excel 2013 also and for some reason ctrl, shift, enter doesn't work but was able to insert it keeping the format. It came out looking just like how you posted with the colors and the brackets. Am I doing something wrong? Im not work a lot in excel if there is something I need to tinker with.

Thanks in advance.

This worked for your example given. Are there any instances where this will not work?

Excel 2010
AB
LIST
QTY.MARK
s-24
b-25
s-143-L
B-144-L
X

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]4[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]336[/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]A9[/TH]
[TD="align: left"]{=SUM(IFERROR(SUBSTITUTE(MID(B3:B7,FIND("-",B3:B7)+1,LEN(B3:B7)),"-L","")+0,""))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Sorry I messed up inputting the formula.

My ctrl shift enter isnt working correctly I guess but I got it.

Thank I really appreciate it.

Try the following array formula (to be entered using Ctrl+Shift+Enter, not just Enter):

=SUM(IFERROR(--MID(SUBSTITUTE(B3:B7,"-L",""),3,99),0))
 
Upvote 0
Is there a reason why it wouldnt work in Autocadd and it does in excel? Must be the way im putting in the equation????
 
Upvote 0
63falcondude I got yours to work also. Just not in Autocad yet :confused: if you have any pointers on inserting with other programs that may do the trick.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
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