Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
rkd
 
Posts: n/a
Default Replacing characters in numeric text strings and SUMming


Hi,

Can anybody help me SUM the following two numbers *without* changing
the orginal cell contents? Excel sees them as text and the second
number is a minus number. I'd rather do this with regular formulae than
VBA, but I'll settle for either ;)


Thanks a mill.


$1,418.26
($2,189.74)
---------------
-771.48

  #2   Report Post  
Posted to microsoft.public.excel.misc
Peo Sjoblom
 
Posts: n/a
Default Replacing characters in numeric text strings and SUMming

If there are no other invisible characters involved

=SUM(--(A1:A2))

entered with ctrl + shift & enter

or

=SUMPRODUCT(--(A1:A2))

entered normally

--

Regards,

Peo Sjoblom

Excel 95 - Excel 2007
Northwest Excel Solutions
www.nwexcelsolutions.com
"It is a good thing to follow the first law of holes;
if you are in one stop digging." Lord Healey


"rkd" wrote in message
ups.com...

Hi,

Can anybody help me SUM the following two numbers *without* changing
the orginal cell contents? Excel sees them as text and the second
number is a minus number. I'd rather do this with regular formulae than
VBA, but I'll settle for either ;)


Thanks a mill.


$1,418.26
($2,189.74)
---------------
-771.48



  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default Replacing characters in numeric text strings and SUMming

Or, as an alternative,
=VALUE(A1)+VALUE(A2)

  #4   Report Post  
Posted to microsoft.public.excel.misc
rkd
 
Posts: n/a
Default Replacing characters in numeric text strings and SUMming


That was easier than I expected -- ended up using SUMPRODUCT!

Thanks a lot -- much appreciated.

  #5   Report Post  
Posted to microsoft.public.excel.misc
rkd
 
Posts: n/a
Default Replacing characters in numeric text strings and SUMming


Thanks also -- good to know!



  #6   Report Post  
Posted to microsoft.public.excel.misc
rkd
 
Posts: n/a
Default Replacing characters in numeric text strings and SUMming


Actually, without thinking I used the formula against the numbers I did
a Find/Replace on which worked fine but
when I tried it against the numbers in example format I'm getting
'#VALUE!' errors -- any ideas?


Thanks.

  #7   Report Post  
Posted to microsoft.public.excel.misc
rkd
 
Posts: n/a
Default Replacing characters in numeric text strings and SUMming


The dollar and parentheses are part of the text strings in the example,
so from what I can tell they need to be stripped
out and the numbers in parentheses converted to negative before the
formulae above will work!?

Also, as I said above, I need to keep the original cells as they are
with the dollar sign and parentheses.

thanks again.

  #8   Report Post  
Posted to microsoft.public.excel.misc
rkd
 
Posts: n/a
Default Replacing characters in numeric text strings and SUMming


Ok, I ended up doing this a rather unneat way but it works. I made an
out-of-sight column
corresponding to the original column with this formula:

=IF(ISTEXT(L6),--(IF(LEFT(L6,1)="(",-RIGHT(LEFT(L6,LEN(L6)-1),LEN(LEFT(L6,LEN(L6)-1))-2),RIGHT(L6,LEN(L6)-1))),)

This stripped out the the $,(,) characters and adds a '-' for negative
numbers in parentheses. Then I AutoSum the column and
referenced the result where I needed it.

If anybody knows a neater way I'd be interested to see/hear it.

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
Summing partial strings. [email protected] Excel Worksheet Functions 4 October 8th 05 11:32 AM


All times are GMT +1. The time now is 07:33 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"