Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is this a valid IF statement in Excel?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is this a valid IF statement in Excel?
I'm not sure about the RC but this works for what you have described.
=IF(AND(L1="nj 07733",A1=981621),"holmdel",M1) " 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change cell color for valid if statement | Excel Discussion (Misc queries) | |||
Excel - File format is not Valid | Excel Discussion (Misc queries) | |||
<xxx is not a valid add-in error in Excel 2003 SP2 | Excel Programming | |||
Excel 2007 - Reference is not valid | Excel Discussion (Misc queries) | |||
Creating a Pivot Table from a valid SQL statement without MS Query | Excel Programming |