How can I extract the second half of addition ?

  • Thread starter Thread starter Gilbert DE CEULAER
  • Start date Start date
Thanks, Ron, I do not understand the code... but it works.
Gilbert

I'm glad it works. Thanks for the feedback.

The part of the code that you won't find in the HELP section has to do with the
regular expression engine. There is information here:

http://support.microsoft.com/default.aspx?scid=kb;en-us;818802&Product=vbb
http://msdn2.microsoft.com/en-us/library/6wzad2b2.aspx
http://www.regular-expressions.info/reference.html

The re.Pattern that I am using, "\d(\+\d+$)"

matches

any digit
followed by a '+'
followed by any number of digits
followed by the end of line.

So it is looking for a pattern which matches anything like:

6+2
or
6+234

etc.

If that pattern matches, then it returns everything except the leading digit.
--ron
 
Hello,

Ron's VBA solution might seem preferrable but there is a non-VBA
solution:
Define the name SecSumPar, for example, which refers to:
=MID(GET.CELL(6,INDIRECT("RC[-1]",FALSE)),1+LOOKUP(2,1/
("+"=MID(GET.CELL(6,INDIRECT("RC[-1]",FALSE)),ROW(INDIRECT("1:"&LEN(GET.CELL(6,INDIRECT("RC[-1]",FALSE))))),
1)),ROW(INDIRECT("1:"&LEN(GET.CELL(6,INDIRECT("RC[-1]",FALSE)))))),
999)

Then insert into the next cell right to your cell with =3+4:
=SecSumPar
and you will get
4

Regards,
Bernd
 
Back
Top