Thanks:  0
Likes:  0

1. I am trying to write a formula to add the number values in a cell. For example If I populate cell (A1) with the number 12345 I would like to see the sum of those numbers in cell (B1). I can pull this off using LEN and MID.

However, if column A is populated with number values of varying lengths my formula breaks. I DO NOT want to do this using VBA. Any ideas?

2. {=SUM(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)+0)}

Note: This is an array formula which is entered using the Control+Shift+Enter key combination.

[ This Message was edited by: Mark W. on 2002-04-25 16:04 ]

3. Hi,

Array enter
=SUM(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)+0)

Must be entered with Ctrl-Shift-Enter

HTH,
Jay

EDIT: Obviously Mark was quicker on the draw here with the same answer. He is one fast gunslinger. This post isn't big enough for the two of us, so I will slink away now.

[ This Message was edited by: Jay Petrulis on 2002-04-25 16:07 ]

4. Hi,

The above formulas fail if the cell is:

a. < 0
b. blank
c. non-integer
d. contain any non-numeric characters

The following corrects the first three (assuming the decimal separator is a .)

{=IF(LEN(A1),SUM(MID(ABS(SUBSTITUTE(A1,".","")),ROW(INDIRECT("1:"&LEN(ABS(SUBSTITUTE(A1,".",""))))),1)+0),0)}

again, array-entered.

Obviously this is overkill, so please take this with a grain of salt, as the primary formula works fine.

Bye,
Jay

EDIT: Or, to correct all four
=IF(ISNUMBER(A1),SUM(MID(ABS(SUBSTITUTE(A1,".","")),ROW(INDIRECT("1:"&LEN(ABS(SUBSTITUTE(A1,".",""))))),1)+0),0)

[ This Message was edited by: Jay Petrulis on 2002-04-25 17:08 ]

5. On 2002-04-25 17:05, Jay Petrulis wrote:
Hi,

The above formulas fail if the cell is:

a. < 0
b. blank
c. non-integer
d. contain any non-numeric characters

The following corrects the first three (assuming the decimal separator is a .)

...

[ This Message was edited by: Jay Petrulis on 2002-04-25 17:08 ]
Or, you could setup Data Validation on A1.

6. On 2002-04-25 17:41, Mark W. wrote:
On 2002-04-25 17:05, Jay Petrulis wrote:
Hi,

The above formulas fail if the cell is:

a. < 0
b. blank
c. non-integer
d. contain any non-numeric characters

The following corrects the first three (assuming the decimal separator is a .)

...

[ This Message was edited by: Jay Petrulis on 2002-04-25 17:08 ]
Or, you could setup Data Validation on A1.
Now why would anybody want to do something simple and painless when they can do something that is nearly impossible to decipher? Who want easy when you can have a Rube Goldberg solution.

I didn't even think of the obvious. Way cool.

Bye,
Jay

7. THANKS FOR THE QUICK HELP!!!!!

## User Tag List

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•