Sum of numbers in a single cell

Mypaperdue

Board Regular
Joined
Feb 10, 2015
Messages
112
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1234[/TD]
[TD]111[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1235[/TD]
[TD]112[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]1236[/TD]
[TD]113[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]1237[/TD]
[TD]114[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]1238[/TD]
[TD]115[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]1239[/TD]
[TD]116[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]12310[/TD]
[TD]11-3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Good morning/afternoon

I am running a simple test in excel and I was hoping to get some help please. Pretty much all i am doing is taking the different of the numbers in cell A. For example the different between 2&1, 3&2 and 4&3 in cell A2 is 111 so cell B display 111 and so on but when the cell is showing a double such as 10 or so on...its displaying a negative number as shown in cell B7. So far this is the formula I have. =MID(A2,2,2)-LEFT(A2)&MID(A2,4,3)-MID(A2,2,2)&RIGHT(A2)-MID(A2,4,3)

Any help would be gladly appreciated. Thanks
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
So what do you expect B7 to display?
Are all the numbers a minimum of 4 digits?
What's the maximum number of digits a number can be?
 
Last edited:
Upvote 0
Based on your minimum four digits (you didnt specify a maximum as requsted).
what should the result of these be?

12311
12345
 
Upvote 0
Based on your minimum four digits (you didnt specify a maximum as requsted).
what should the result of these be?

12311
12345

The numbers are always in ascending order so 12311 would never be an option and as for 12345...the total number count is 5, instead of just 4 numbers (1234) which would be 111.
 
Upvote 0
Try this

=MID(A1,2,1)-MID(A1,1,1)&MID(A1,3,1)-MID(A1,2,1)&RIGHT(A1,IF(LEN(A1)=5,2,1))-MID(A1,3,1)

So the assumption is:

Each number will consist of 4 or 5 digits.
In each case the difference between the 1st and 2nd digits and 2nd and 3rd digits are returned.
Finally return the difference between the 3rd and 4th digits UNLESS the number is 5 digits long in which case regard the 4th and 5th digits as a 2 digit number and return the difference between that and the 3rd digit.
 
Last edited:
Upvote 0
:confused: Why is that? What is the difference between 12311 and 12310 that you listed before?


in term of not count the single digits as its own. I thouhg he meat like...1 2 3 1 1 instead of 1 2 3 (11) or 1 2 3 (10)

I am making this sound more complicated the it actual is. 1 2 3 (10) So the different between 2&1=1, 3&2=1 and (10)&3 would be 7 so 117

Also 1 2 3 (11) again the different between 2&1=1, 3&2=1 and (11)&3=8 so 118 so so on
 
Upvote 0
Try this

=MID(A1,2,1)-MID(A1,1,1)&MID(A1,3,1)-MID(A1,2,1)&RIGHT(A1,IF(LEN(A1)=5,2,1))-MID(A1,3,1)

So the assumption is:

Each number will consist of 4 or 5 digits.
In each case the difference between the 1st and 2nd digits and 2nd and 3rd digits are returned.
Finally return the difference between the 3rd and 4th digits UNLESS the number is 5 digits long in which case regard the 4th and 5th digits as a 2 digit number and return the difference between that and the 3rd digit.

I tried this but no avail
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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