Add up all Numbers in a Cell with a Line Break?

Willy Excel

New Member
Joined
Jun 8, 2017
Messages
24
Sum ThesePlace Here:
2
1
3
0
1
2
3
22

<tbody>
</tbody>

Greetings! Is there a simple method to SUM all digits within a cell with line breaks?

Some cells in the column have no numbers, some have one number, and others have a line break with a number on top and number on bottom.

Or: is there a way to highlight the cells and show "Sum:" down bottom?

Thanks!<attachment></attachment>
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Re: How to Add up all Numbers in a Cell with a Line Break?

Hi

Does this work for you?

Code:
=SUM(A1:INDEX(A1:A100,MATCH(TRUE,(A1:A100=""),0)))

It's an array formula so you'll need to press CTRL, SHIFT and ENTER in the Formula bar (if all goes well the formula will be wrapped in { }).

HTH
 
Last edited:
Upvote 0
Re: How to Add up all Numbers in a Cell with a Line Break?

Thank you, Jazz. I tried your forumula and no luck. No error messages, but the totals are incorrect. Any other formula ideas?
 
Upvote 0
Some cells in the column have no numbers, some have one number, and others have a line break with a number on top and number on bottom.

Hi, welcome to the forum!

Here is one option you could try:


Excel 2013
AB
22 13
30
41 23
Sheet1
Cell Formulas
RangeFormula
B2=SUMPRODUCT(0+(0&TRIM(MID(SUBSTITUTE(A2,CHAR(10),REPT(" ",99)),{1,2}*99-98,99))))
 
Upvote 0
Thank you, FormR. For the blank cells, it works. For the cells with one number, it works. However, for the cells with a line break, it has the #VALUE! error. Any ideas on how to solve that?
 
Upvote 0
However, for the cells with a line break, it has the #VALUE! error. Any ideas on how to solve that?

Hi, it works for me as you can see in my screen shot. Maybe your line break is a different character to CHAR(10)?

If you put this formula in a spare cell and point it to a cell that has a line break after a single digit number what does it return?

=CODE(MID(A1,2,1))
 
Upvote 0
formula works with the file you attached to your cross post at MSOfficeForums
 
Upvote 0
Pointing to a cell with a 1 over a 1, it returns 13.

Hi, try changing as below:

=SUMPRODUCT(0+(0&TRIM(MID(SUBSTITUTE(A2,CHAR(13),REPT(" ",99)),{1,2}*99-98,99))))

Can you please post links here to your thread at the other forum?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,976
Members
448,934
Latest member
audette89

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