![]() |
How to determine the number?
Does anyone have any suggestions on how to determine the number?
For example, 2584 in cell A1, then it should return 2+5+8+4=19 in cell B1. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
How to determine the number?
Try this
Sub addupnumberdigits() ac = ActiveCell mysum = 0 For i = 1 To Len(ac) mysum = mysum + Mid(ac, i, 1) Next i MsgBox mysum End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Eric" wrote in message ... Does anyone have any suggestions on how to determine the number? For example, 2584 in cell A1, then it should return 2+5+8+4=19 in cell B1. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
How to determine the number?
=LEFT(A1,1)+RIGHT(A1,1)+MID(A1,2,1)+MID(A1,3,1)
-- Gary''s Student - gsnu200802 |
How to determine the number?
Thank everyone for any suggestions
Could you please tell me how to apply following codes? Thanks you very much for any suggestions Eric "Don Guillett" wrote: Try this Sub addupnumberdigits() ac = ActiveCell mysum = 0 For i = 1 To Len(ac) mysum = mysum + Mid(ac, i, 1) Next i MsgBox mysum End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Eric" wrote in message ... Does anyone have any suggestions on how to determine the number? For example, 2584 in cell A1, then it should return 2+5+8+4=19 in cell B1. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
How to determine the number?
Here is a non-vba, non character length specific possibility. Assuming your
value is in cell A1: =SUMPRODUCT(--(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))) Hope this helps. -- John C "Eric" wrote: Does anyone have any suggestions on how to determine the number? For example, 2584 in cell A1, then it should return 2+5+8+4=19 in cell B1. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
How to determine the number?
Hi Eric
try =SUMPRODUCT(--MID(A1,ROW(INDIRECT("$1:$"&LEN(A1))),1)) -- Regards Roger Govier "Eric" wrote in message ... Does anyone have any suggestions on how to determine the number? For example, 2584 in cell A1, then it should return 2+5+8+4=19 in cell B1. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
How to determine the number?
The absolute references in the INDIRECT statement are unnecessary. :)
-- John C "Roger Govier" wrote: Hi Eric try =SUMPRODUCT(--MID(A1,ROW(INDIRECT("$1:$"&LEN(A1))),1)) -- Regards Roger Govier "Eric" wrote in message ... Does anyone have any suggestions on how to determine the number? For example, 2584 in cell A1, then it should return 2+5+8+4=19 in cell B1. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
How to determine the number?
Absolutely True
Comes out of habit (and does not cause a problem(bg) -- Regards Roger Govier "John C" <johnc@stateofdenial wrote in message ... The absolute references in the INDIRECT statement are unnecessary. :) -- John C "Roger Govier" wrote: Hi Eric try =SUMPRODUCT(--MID(A1,ROW(INDIRECT("$1:$"&LEN(A1))),1)) -- Regards Roger Govier "Eric" wrote in message ... Does anyone have any suggestions on how to determine the number? For example, 2584 in cell A1, then it should return 2+5+8+4=19 in cell B1. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
All times are GMT +1. The time now is 04:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com