Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change cell color for valid if statement Chris H Excel Discussion (Misc queries) 3 April 2nd 23 07:32 PM
Excel - File format is not Valid Gord Excel Discussion (Misc queries) 0 July 30th 08 03:41 PM
<xxx is not a valid add-in error in Excel 2003 SP2 aniruddha_bapat Excel Programming 0 December 15th 07 07:56 PM
Excel 2007 - Reference is not valid carryt Excel Discussion (Misc queries) 1 August 3rd 07 09:44 PM
Creating a Pivot Table from a valid SQL statement without MS Query CElzinga Excel Programming 0 September 9th 04 11:51 PM


All times are GMT +1. The time now is 07:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"