ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Summing up digits in a cell (https://www.excelbanter.com/excel-discussion-misc-queries/188303-summing-up-digits-cell.html)

Sai Krishna[_2_]

Summing up digits in a cell
 
Hi,

i need to add all the digits in a cell. For example, if I have a number 58
in a cell, the adjacent cell should return a value of 13.
regards
krishna

Gaurav[_3_]

Summing up digits in a cell
 
If you only have 2 digits, try this

=SUM(LEFT(A2,1),RIGHT(A2,1))


"Sai Krishna" wrote in message
...
Hi,

i need to add all the digits in a cell. For example, if I have a number 58
in a cell, the adjacent cell should return a value of 13.
regards
krishna




Gary''s Student

Summing up digits in a cell
 
Try this small UDF:

Function digicount(r As Range) As Integer
Dim n As Integer
digicount = 0
v = r.Value
L = Len(v)
For i = 1 To L
n = Mid(v, i, 1)
digicount = digicount + n
Next
End Function
--
Gary''s Student - gsnu200787


"Sai Krishna" wrote:

Hi,

i need to add all the digits in a cell. For example, if I have a number 58
in a cell, the adjacent cell should return a value of 13.
regards
krishna


Brad

Summing up digits in a cell
 
=SUMPRODUCT(--MID(A4,ROW($A$1:INDEX($A:$A,LEN(A4),1)),1))
--
Wag more, bark less


"Sai Krishna" wrote:

Hi,

i need to add all the digits in a cell. For example, if I have a number 58
in a cell, the adjacent cell should return a value of 13.
regards
krishna


Sai Krishna[_2_]

Summing up digits in a cell
 
Thanks gaurav, this has helped for two digits.
regards
krishna

"Gaurav" wrote:

If you only have 2 digits, try this

=SUM(LEFT(A2,1),RIGHT(A2,1))


"Sai Krishna" wrote in message
...
Hi,

i need to add all the digits in a cell. For example, if I have a number 58
in a cell, the adjacent cell should return a value of 13.
regards
krishna





Sai Krishna[_2_]

Summing up digits in a cell
 

Thanks a ton Brad. Was looking for something as useful and simple as this.
regards
krishna



"Brad" wrote:

=SUMPRODUCT(--MID(A4,ROW($A$1:INDEX($A:$A,LEN(A4),1)),1))
--
Wag more, bark less


"Sai Krishna" wrote:

Hi,

i need to add all the digits in a cell. For example, if I have a number 58
in a cell, the adjacent cell should return a value of 13.
regards
krishna


Brad

Summing up digits in a cell
 
You're welcome
--
Wag more, bark less


"Sai Krishna" wrote:


Thanks a ton Brad. Was looking for something as useful and simple as this.
regards
krishna



"Brad" wrote:

=SUMPRODUCT(--MID(A4,ROW($A$1:INDEX($A:$A,LEN(A4),1)),1))
--
Wag more, bark less


"Sai Krishna" wrote:

Hi,

i need to add all the digits in a cell. For example, if I have a number 58
in a cell, the adjacent cell should return a value of 13.
regards
krishna


Dana DeLouis

Summing up digits in a cell
 
... this has helped for two digits.

Another option for 1-2 digit numbers ...

=A1-9*INT(A1/10)

--
Dana DeLouis


"Sai Krishna" wrote in message ...

Thanks gaurav, this has helped for two digits.
regards
krishna

"Gaurav" wrote:


If you only have 2 digits, try this

=SUM(LEFT(A2,1),RIGHT(A2,1))


"Sai Krishna" wrote in message
...

Hi,

i need to add all the digits in a cell. For example, if I have a number 58
in a cell, the adjacent cell should return a value of 13.
regards
krishna





All times are GMT +1. The time now is 11:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com