# formula help

#### ron0816

##### New Member
I need so assistance with a formula. I am trying to use and if statement to determine a amount. I have a column that has a value of 1,2,or 3. If the value is 3 I need to take the amount in another column and multiply it by -1. Also if the value is 1 but the amount is already a negative amount I need to multiply it by -1. Any help you can give me is appreciated. Thanks

#### kweaver

##### Well-known Member
Try

Code:
``````Sub FixCol()
Dim LR As Long
Dim i As Integer
LR = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To LR
If Cells(i, 1) = 1 And Cells(i, 2) < 0 Then
Cells(i, 2) = Cells(i, 2) * -1
ElseIf Cells(i, 1) = 3 Then
Cells(i, 2) = Cells(i, 2) * -1
Else
End If
Next i
End Sub``````
Might be possible without a loop, but haven't given it enough thougth.

#### ron0816

##### New Member
Could you put this into a If,And statement. if column g has the values of 1,2, or 3 and column j has the amounts.

#### kweaver

##### Well-known Member
Then, where do you want the changes?

Code:
``=IF(G1=3,-J1,IF(AND(G1=1,J1<0),-J1,J1))``

Last edited:

#### ron0816

##### New Member
if the changes could occur in column m that would be fine.

#### ron0816

##### New Member
If I could see the formula rather than the code that would be great.

#### DanteAmor

##### Well-known Member
You need something like this

<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td style="text-align:right; ">1</td><td style="text-align:right; ">FALSO</td><td style="text-align:right; ">6</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td style="text-align:right; ">2</td><td style="text-align:right; ">FALSO</td><td style="text-align:right; ">4</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td style="text-align:right; ">3</td><td style="text-align:right; ">-8</td><td style="text-align:right; ">8</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td style="text-align:right; ">1</td><td style="text-align:right; ">5</td><td style="text-align:right; ">-5</td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b>Formeln der Tabelle</b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Zelle</td><td >Formel</td></tr><tr><td >B2</td><td >=IF(A2=3,C2*-1,IF(A2=1,IF(C2<0,C2*-1)))</td></tr></table></td></tr></table>

If it's something different, you could give examples.

#### ron0816

##### New Member
That works perfect. You guys are the best

#### DanteAmor

##### Well-known Member
That works perfect. You guys are the best

1,078,486
Messages
5,340,618
Members
399,387
Latest member
amrita34

### This Week's Hot Topics

• Problem with Radio Button's format control
I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
• Last Display on userform to a Listbox
[CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
• Rename and move files to a new location
Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
• Help with True/False Formula
Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
• Clear extra characters from a provided range of cells
Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
• Help with Current and highest streaks
Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...