only sum last three numbers

thebeans

Board Regular
Joined
Mar 20, 2016
Messages
87
hi all
I have a string of numbers 123456,but sometimes there could be a letter in there i.e 123x56,12345x.what I wont to do is sum up the last three numbers. I have this formula which works ok till a letter comes along
=IFERROR(SUMPRODUCT(--MID(AB8,ROW(INDIRECT("1:" & LEN(AB8))),1)),"").I have no idea how to get it to ignore the letter and just sum up the other two

thanks richard
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Try the following array formula (to be entered using Ctrl+Shift+Enter, not just Enter):

=SUM(IFERROR(--MID(AB8,ROW(INDIRECT(LEN(AB8)-2&":"&LEN(AB8))),1),0))
 
Last edited:
Upvote 0
Here is another formula (a non-volatile one) for you to consider...

=SUMPRODUCT(IFERROR(0+MID(RIGHT(AB8,4-ISNUMBER(-RIGHT(AB8,3))),{1,2,3,4},1),0))
 
Last edited:
Upvote 0
If I have understood correctly, Tetra's odea could be made non-volatile and shorter as follows.
Still confirmed with CSE
{=SUM(IFERROR(--MID(RIGHT(AB8,3),{1,2,3},1),0))}

.. or if you don't like the CSE
=SUM(INDEX(IFERROR(--MID(RIGHT(AB8,3),{1,2,3},1),0),0))


Rick
Your formula does a different job, the requirement being to "ignore the letter and just sum up the other two"
 
Last edited:
Upvote 0
thanks rick and peter yes did go with =SUM(INDEX(IFERROR(--MID(RIGHT(AB8,3),{1,2,3},1),0),0)).I have a set of rows now with some at 0.what would I have to add to leave them blank
thanks Richard
[TABLE="width: 64"]
<colgroup><col></colgroup><tbody>[TR]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Rick
Your formula does a different job, the requirement being to "ignore the letter and just sum up the other two"
Completely missed that. :banghead:

Here is the formula I would have posted had I read the question correctly...

=SUMPRODUCT(IFERROR(0+MID(RIGHT(A1,3),{1,2,3},1),0))
 
Upvote 0
If you are happy to have them just 'appear' blank then you could format that column with the custom format of 0;; or use Conditional Formatting but of course both of those things just hide the zeros, it doesn't remove them.

Otherwise, one way would be to use

=IF(SUM(INDEX(IFERROR(--MID(RIGHT(AB11,3),{1,2,3},1),0),0))=0,"",SUM(INDEX(IFERROR(--MID(RIGHT(AB11,3),{1,2,3},1),0),0)))
 
Upvote 0
Another way would be

=IFERROR(1/(1/SUM(INDEX(IFERROR(--MID(RIGHT(AB11,3),{1,2,3},1),0),0))),"")
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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