Amend Value to ABS

somesoldiers

Board Regular
Joined
Feb 23, 2008
Messages
199
Hi Guys

I need to amend below code so that for Column N the code will include if the value of ABS((N-(N-1)) <=2 but whereever I put the ABS seems to give an error.

Appreciate any help

thanks

Noel

Code:
  If .Range("H" & i).Value = .Range("H" & i + 1).Value And _
        .Range("G" & i).Value = .Range("G" & i + 1).Value And _
        .Range("J" & i).Value = .Range("J" & i + 1).Value And _
        .Range("M" & i).Value = .Range("M" & i + 1).Value And _
        .Range("N" & i).Value - .Range("N" & i + 1).Value <= 2 And _
        .Range("O" & i).Value = .Range("O" & i + 1).Value Then
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try

Code:
If .Range("H" & i).Value = .Range("H" & i + 1).Value And _
        .Range("G" & i).Value = .Range("G" & i + 1).Value And _
        .Range("J" & i).Value = .Range("J" & i + 1).Value And _
        .Range("M" & i).Value = .Range("M" & i + 1).Value And _
        Abs(.Range("N" & i).Value - .Range("N" & i + 1).Value) <= 2 And _
        .Range("O" & i).Value = .Range("O" & i + 1).Value Then
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,626
Members
452,933
Latest member
patv

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