Re: Formula to sum the digits

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



The double minus signs are there to make the convert the output from
the MID function, that are strings, to numbers that the SUM function
likes. You can use (--)double minus, 0+ (zero plus) , or 1* (one
times) for the same pupose.
They all result in a number if it is possible to interprete the string
as a number without changing the value of the number.

Hope this helps / Lars-Åke


On Sun, 11 Jan 2009 22:52:10 -0500, "hooroy63" <hooroy63@xxxxxxxxx>
wrote:

Lars-Ake,
Your concise array formula works great. Please explain the minus signs at
the beginning. I've seen multiple minus signs like thie in array formulas
before, but I don't know what they do or why they're there. TIA.
Roy

"Lars-Åke Aspelin" <larske@xxxxxxxxxxxxxxxxxx> wrote in message
news:ik86m4l55bbta37ierruv200lm3hg9giig@xxxxxxxxxx
On Tue, 6 Jan 2009 01:07:01 -0800, Bahareh
<Bahareh@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Hello

I have a work sheet of mobile sites configurations which its standars to
write is sth like [2220] or might be [224] or even [22].
Currenly to find sum of the equipmets I have to put manually 6 for [2220]
for example. How can I make it Authomatic by formula? I thought about Sum
formula combined with Left formula but as the digits might be 2 digit or 4
in
some cells so there is error as ] can't be sumed. Do you know any better
way?

Exp:

[2220] =2+2+2=6
[224] =2+2+4=8
[22] =4


Try this formula

=SUM(--MID(A1,ROW(OFFSET(A$2,,,FIND("]",A1)-2)),1))

Note: This is an array formula that has to be confirmed with
CTRL+SHIFT+ENTER rather than just ENTER

Hope this helps / Lars-Åke


.



Relevant Pages

  • Re: Cantorian pseudomathematics
    ... >>> number of strings of that length. ... So, for every single L, the sum ... > between element count and value which characterizes the naturals ... And TO can repeat his insanity as often as he wants without making any ...
    (sci.math)
  • Re: Cantorian pseudomathematics
    ... >>> Because the set of all finite strings on a finite alphabet is not ... >>> strings, of ALL lengths, on a finite alphabet is infinite. ... >> L is a sum of a finite number of finite terms, ...
    (sci.math)
  • Re: Pythons simplicity philosophy
    ... > As to sum(), when learning string addition, ... the "summing strings" case instead, ... When the sequence is empty, ... 1000 loops, best of 3: ...
    (comp.lang.python)
  • Re: foreach or List.ForEach
    ... Liststrings = GetStrings; ... {int sum = 0; stopwatch.Reset; stopwatch.Start; ... {foreach {sum += s.Length;} ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Euler problem #22
    ... The names.txt file I was using had 4 linefeeds ... sum += i.succ * name.split. ... I guess an array of strings. ... and the inject does the conversion from string to number. ...
    (comp.lang.forth)