multiple arguments for a if and formula in excel 2010

Gisher

New Member
Joined
Jan 26, 2015
Messages
5
hi Folks,

thanks for taking a look at this for me. Here is what I would like help with. I have a column of data that I need to have the following applied to
if the number is less than or equal to 400, then add 20 to it. If the number is greater than 400 and less than or equal to 1499 then apply 5% to it. If the number is greater than or equal to 1500, then apply 75 to it. Then add a value in the adjacent column.

Thanks in advance for your help.

Best,
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
In what column is the data and what value do you want added to the adjacent column?
 
Upvote 0
In what column is the data and what value do you want added to the adjacent column?

In column "I" and I want what ever numer value is in each cell in col "J" added.

So as example ref I2 would be 400 and J2 would be 42 I want the 42 to be added on to whatever number is calculated as a result of the first part of the arugment. I hope I am making sense.
Best,
 
Upvote 0
I'm not sure if I understood correctly but try:
Code:
Sub Test()
    Application.ScreenUpdating = False
    Dim bottomI As Long
    bottomI = Range("I" & Rows.Count).End(xlUp).Row
    Dim rng As Range
    For Each rng In Range("I2:I" & bottomI)
        If rng <= 400 Then
            rng = rng + 20 + Cells(rng.Row, "J")
        ElseIf rng > 400 And rng <= 1499 Then
            rng = rng + (rng * 0.05) + Cells(rng.Row, "J")
        ElseIf rng >= 1500 Then
            rng = rng + 75 + Cells(rng.Row, "J")
        End If
    Next rng
Application.ScreenUpdating = True
End Sub
 
Upvote 0
I'm not sure if I understood correctly but try:
Code:
Sub Test()
    Application.ScreenUpdating = False
    Dim bottomI As Long
    bottomI = Range("I" & Rows.Count).End(xlUp).Row
    Dim rng As Range
    For Each rng In Range("I2:I" & bottomI)
        If rng <= 400 Then
            rng = rng + 20 + Cells(rng.Row, "J")
        ElseIf rng > 400 And rng <= 1499 Then
            rng = rng + (rng * 0.05) + Cells(rng.Row, "J")
        ElseIf rng >= 1500 Then
            rng = rng + 75 + Cells(rng.Row, "J")
        End If
    Next rng
Application.ScreenUpdating = True
End Sub

Rookie mistake, could I have without code? Id like a formula if possible. My mistake for not mentioning that earlier.

Best,
 
Upvote 0
@Gisher: I thought that you wanted the result returned in column I. That is why I went with a macro. The formula, which is always the best way to go, would have returned a circular reference error if placed in column I. The macro doesn't have that problem. I'm glad it worked out. :)
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,900
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top