Is this a valid IF statement in Excel?
Hi,
You don't make it clear what your trying to do so if you want a macro to
write a formula to a cell to execute your if statemment try this
ActiveCell.FormulaR1C1 = "=IF(AND(RC[-4]=""NJ
07733"",RC[-12]=98621),RC[-3],HOLDMEL)"
I've assuned HOLDMEL is a named range if its' simply the text HOLDMEL you
want then put it in quotes "HOLDMEL".
If you want a mcro to execute the same if statement try this
Sub stantial()
If ActiveCell.Offset(, -4).Value = "NJ 07733" And ActiveCell.Offset(,
-12).Value = 98621 Then
ActiveCell.Value = ActiveCell.Offset(, -3).Value
Else
ActiveCell.Value = Range("HOLDMEL").Value
End If
End Sub
Likewise if you simply want the text HOLDMEL change the line to this
ActiveCell.Value ="HOLDMEL"
Mike
" wrote:
Hello all,
I am new to Excel programming and was wondering if this is a valid
Excel IF statement for what I want to do:
"=IF(AND(RC[-4]=""NJ 07733"",RC[-12]=""981621""),""HOLMDEL"",RC[-3])"
If cell, 4 cells to the left of the current cell = "NJ 07733" AND
cell, 12 cells to the left of current cell = "981621"
Then
move "HOLMDEL" to current cell
Else
move the contents of cell, 3 cells to the left of current cell to the
current cell.
Thanks for your help ahead of time,
Gabe
|