Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Changing the Negative Sign

I have a file that I import into Excel. The negative sign on some of the
amounts is at the end of the number. Example: 2,778.69-.
Excel dosn't know that this is a negative amount. Is there an easy way to
move the sign to the font of the number or to reformat the cell to show that
it is a negative amount?
Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Changing the Negative Sign

Dim s as String
Dim cell as Range
for each cell in selection.specialCells(xlConstants,xlTextValues)
s = trim(cell)
if isnumeric(s)
cell.value = cdbl(s)
end if
Next

--
Regards,
Tom Ogilvy


"tedd13" wrote:

I have a file that I import into Excel. The negative sign on some of the
amounts is at the end of the number. Example: 2,778.69-.
Excel dosn't know that this is a negative amount. Is there an easy way to
move the sign to the font of the number or to reformat the cell to show that
it is a negative amount?
Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Changing the Negative Sign

You could transform it into an adjacent column

=IF(RIGHT(A1)="-",-1*LEFT(A1,LEN(A1)-1),A1)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"tedd13" wrote in message
...
I have a file that I import into Excel. The negative sign on some of the
amounts is at the end of the number. Example: 2,778.69-.
Excel dosn't know that this is a negative amount. Is there an easy way to
move the sign to the font of the number or to reformat the cell to show

that
it is a negative amount?
Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Changing the Negative Sign

Tom,
That code worked. However, it errors out if it there are no negative signs
in the column I am looking at. I have six columns that may or may not have
negative signs.
Any ideas about how to code around that?
Thanks

"tedd13" wrote:

I have a file that I import into Excel. The negative sign on some of the
amounts is at the end of the number. Example: 2,778.69-.
Excel dosn't know that this is a negative amount. Is there an easy way to
move the sign to the font of the number or to reformat the cell to show that
it is a negative amount?
Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Changing the Negative Sign

Dim s as String
Dim cell as Range, rng as Range
On Error Resume Next
set rng = selection.specialCells(xlConstants,xlTextValues)
On Error goto 0
if not rng is nothing then
for each cell in
s = trim(cell)
if isnumeric(s)
cell.value = cdbl(s)
end if
Next
end If

--
Regards,
Tom Ogilvy

"tedd13" wrote:

Tom,
That code worked. However, it errors out if it there are no negative signs
in the column I am looking at. I have six columns that may or may not have
negative signs.
Any ideas about how to code around that?
Thanks

"tedd13" wrote:

I have a file that I import into Excel. The negative sign on some of the
amounts is at the end of the number. Example: 2,778.69-.
Excel dosn't know that this is a negative amount. Is there an easy way to
move the sign to the font of the number or to reformat the cell to show that
it is a negative amount?
Thanks




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Changing the Negative Sign



format("98.34-","0.00")

returns -98.34

works as long as the first argument is numeric to humans
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
If sign of sum is negative change to positive BigR Excel Worksheet Functions 1 January 12th 10 07:20 PM
Changing color of negative bar when using Invert if negative Breck Charts and Charting in Excel 9 March 4th 08 12:40 PM
Ending Negative Sign edwardpestian Excel Worksheet Functions 4 June 28th 06 10:44 AM
flip negative sign wilson@irco Excel Discussion (Misc queries) 6 March 13th 06 12:30 PM
Deleting a negative sign from an amount in a list (not trailing negative) Fleming Excel Programming 3 May 7th 04 03:50 PM


All times are GMT +1. The time now is 09:01 PM.

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

About Us

"It's about Microsoft Excel"