Formatting Excel Worksheet

K

KI

Please help.
I have a spreadsheet which has various negative numbers entered as follows:
e.g. 5.25-
0.32-
1,502.33- etc etc
Is there any way to format it or a formula which will change the above
numbers so that it is a negtive number
e.g. -5.25,
-0.32, -
1,502.33 etc etc
I have tried all the usual ways to format it but the numbers still remain as
5.25- etc etc
 
D

Don Guillett

this should do it
Sub fixneg()
For Each c In Selection
If Right(c, 1) = "-" Then c.Value = "-" & Left(c, Len(c) - 1)
Next c
End Sub
 
D

Duke Carey

if your number is in A1, then use this formula in B1

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

KI

Thanks for your help.
Worked a treat.

Duke Carey said:
if your number is in A1, then use this formula in B1

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

KI

Thank you.

Don Guillett said:
this should do it
Sub fixneg()
For Each c In Selection
If Right(c, 1) = "-" Then c.Value = "-" & Left(c, Len(c) - 1)
Next c
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top