Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Sum all integers of a given number

Hi,
Is there an easy way to arrange a formula that will Sum all integers
of a given number?

such that when applied on colum A, the result will be B:


21 3
77 14
12345 15
1 1
321 6


thanks for you help,
pchr

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default Sum all integers of a given number

Please don't post the same question in multiple Groups.

Regards,
Paul

"pchr" wrote in message
oups.com...
Hi,
Is there an easy way to arrange a formula that will Sum all integers
of a given number?

such that when applied on colum A, the result will be B:


21 3
77 14
12345 15
1 1
321 6


thanks for you help,
pchr



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Sum all integers of a given number

On 8 Jun, 15:41, pchr wrote:
Hi,
Is there an easy way to arrange a formula that will Sum all integers
of a given number?


Cross posting is a no-no, but on the assumption you may still be
waiting for an answer, here is one way to do it.

Sub sumNumbers()
Dim checkRow As Long
Dim instrPosition As Integer
Dim summedTotal As Long
checkRow = 1
Do
summedTotal = 0
For instrPosition = 1 To Len(Range("a" & checkRow).Value)
summedTotal = summedTotal + _
Mid(Range("a" & checkRow).Value, instrPosition, 1)
Next
Range("B" & checkRow).Value = summedTotal
checkRow = checkRow + 1
Loop Until Range("a" & checkRow).Value = ""
End Sub

--
juux


  #4   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Sum all integers of a given number

Cross posting is okay, multi-posting is irritating.

" wrote:

On 8 Jun, 15:41, pchr wrote:
Hi,
Is there an easy way to arrange a formula that will Sum all integers
of a given number?


Cross posting is a no-no, but on the assumption you may still be
waiting for an answer, here is one way to do it.

Sub sumNumbers()
Dim checkRow As Long
Dim instrPosition As Integer
Dim summedTotal As Long
checkRow = 1
Do
summedTotal = 0
For instrPosition = 1 To Len(Range("a" & checkRow).Value)
summedTotal = summedTotal + _
Mid(Range("a" & checkRow).Value, instrPosition, 1)
Next
Range("B" & checkRow).Value = summedTotal
checkRow = checkRow + 1
Loop Until Range("a" & checkRow).Value = ""
End Sub

--
juux



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Sum all integers of a given number

=SUMPRODUCT(--(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"pchr" wrote in message
oups.com...
Hi,
Is there an easy way to arrange a formula that will Sum all integers
of a given number?

such that when applied on colum A, the result will be B:


21 3
77 14
12345 15
1 1
321 6


thanks for you help,
pchr





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
decrease integers to zero Andi Excel Worksheet Functions 7 May 9th 09 02:35 AM
two integers in one cell KRK New Users to Excel 3 June 29th 08 12:06 AM
Sum all integers of a given number pchr Excel Worksheet Functions 3 June 8th 07 04:18 PM
Seems there is a bug with long integers in VBA Alex Excel Programming 6 May 9th 07 01:40 AM
A list of Consecutive Integers, can I search for missing integers CM Excel Worksheet Functions 4 September 2nd 05 06:38 PM


All times are GMT +1. The time now is 03:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"