Change a negative number to a positive (1 Viewer)

MGumbrell

Registered User.
Local time
Today, 17:51
Joined
Apr 22, 2005
Messages
129
You will have to forgive me, I have actually asked this before but have lost the answer.

I was given a very simple solution.

I have a number of negative numbers that I wish to change to positive.

Somethng must have changed to this forum since my last visit on 25th November 2005 as cannot access any of my old threads where I could have looked for the previous answer.

Thank you
Matt
 

reclusivemonkey

Registered User.
Local time
Today, 17:51
Joined
Oct 5, 2004
Messages
749
I'm not sure if there is a formula for this but if your negative number is "x" then;

Code:
x - (x*2)

should work.

Edit: Sorry, I thought this was in Access (don't *think* ABS() is available in Access). ABS() is a better answer.
 

MGumbrell

Registered User.
Local time
Today, 17:51
Joined
Apr 22, 2005
Messages
129
Thank you for your help. The change as suggested was intended to be in another cell.

Thanks, Matt

Having responded I realised that I hadn't asked the right question. What I should have asked was:-

How can I reverse the sign of a number i.e a negative number to a positive and a postive number to a negative.

Sorry for the confusion.
Matt
 
Last edited:

qafself

Registered User.
Local time
Today, 17:51
Joined
Nov 9, 2005
Messages
119
Changing numbers

If the value you want to change is in say cell A5, surely the simplest way must be to enter in the destination cell "=A5*-1". This can then be copied down the column

Ed
 

Brianwarnock

Retired
Local time
Today, 17:51
Joined
Jun 2, 2003
Messages
12,701
Here are the 2 macros I posted last time.
The lady I wrote them for has her own macro menu with them on so to use the second just highlight the numbers, you can use shift or Ctrl with the mouse, then click on the macro

Brian
Code:
Sub revsign()

'Reverses the sign of all numeric fields on a worksheet

For Each c In ActiveSheet.UsedRange
    If c.Value = " " Then GoTo cont
    If c.Value = "" Then GoTo cont
  If c.Value > -9999999 And c.Value < 99999999 Then
        c.Value = c.Value * -1
    End If
cont:
Next c

End Sub

Sub revsign2()
'Reverses the sign of all numeric fields in selected range

For Each c In ActiveWindow.RangeSelection
    
    If c.Value = " " Then GoTo cont
    If c.Value = "" Then GoTo cont
  If c.Value > -9999999 And c.Value < 99999999 Then
        c.Value = c.Value * -1
    End If
cont:
Next c

End Sub
 

Users who are viewing this thread

Top Bottom