Adding Numbers in a Cell

kwedde01

Board Regular
Joined
Jun 9, 2005
Messages
140
How can I add several numbers in a cell.

For example: Cell A1 would contain the numbers 5,10,6,12,etc.

Each comma represents the end of a number and the start of a new one. How would I then add these 4 numbers in the same cell.
 

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
Need more info.
Cells have just those 4 numbers? Or are there more numbers (based on your "etc." you typed)? Do you mean add as in arithmetic or add as in move to the cell?

Michael
 

kwedde01

Board Regular
Joined
Jun 9, 2005
Messages
140
A cell will have anywhere from 23 to 26 numbers entered in that particular cell. The addition is arithmetic add.

So 2,5,3,8 should give a result of 18... The formula is to be used throughout the worksheet
 

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
OK
Your saying it may have
18,12,8,2,15,36,44,21,15
And you want to add the 1st 4 numbers? or all numbers?

If it is all numbers, each number is separated by a comma correct?

Michael
 

kwedde01

Board Regular
Joined
Jun 9, 2005
Messages
140
Not the first four but all numbers within the cell, an dyes each number is separated by a comma.


Thanks for any help you can offer
 

just_jon

Legend
Joined
Sep 3, 2002
Messages
10,473
With he help of the EVAL function from the Morefunc addin,
Book1
HIJK
35,10,6,12
4
Sheet3


The Morefunc add-in is a free download, available at: this site.
 

kwedde01

Board Regular
Joined
Jun 9, 2005
Messages
140
Thanks alot...

Is there another way of doing this? The file will be used on different computers, and hence not everyone will have the morefunc add-in
 

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
I saw the following code used in past. It is not mine but I understand it to work.

I can do it with a custom function:


Code:
--------------------------------------------------------------------------------

Function Test(Rng As Range) As Variant 
    Test = Evaluate(Application.Substitute(Rng, ",", "+")) 
End Function 

--------------------------------------------------------------------------------






Then type:

=Test(A1)




Michael
 

kwedde01

Board Regular
Joined
Jun 9, 2005
Messages
140
I get an error message of #NAME when i try the Test function.

I try entering 2,3 in cell A1 on a new sheet, and I place the formula in cell b1 but get that error messages

Any suggestions
 

Forum statistics

Threads
1,078,398
Messages
5,339,983
Members
399,345
Latest member
elvy

Some videos you may like

This Week's Hot Topics

Top