RC Cell Reference in 2010

joerg1004

New Member
Joined
Jul 29, 2011
Messages
3
I have some code which I initially created in Excel 2003.

Sheets("Student Report").Cells(3, 20) = "=IF(RC17<>0,INDEX(Names!C2,MATCH(RC17,Names!C1,0)) & "", "" & INDEX(Names!C3,MATCH(RC17,Names!C1,0)),"""")"

It has worked like a charm. In the spreadsheet cell it showed up as:
=IF(RC17<>0,INDEX(Names!C2,MATCH(RC17,Names!C1,0)) & ", " & INDEX(Names!C3,MATCH(RC17,Names!C1,0)),"")

I am now trying to run my spreadsheet under Excel 2010. I've changed my xls spreadsheet to xlsm and this very code now shows up in the spreadsheet cell as this:
=IF(R[14]C[451]<>0,INDEX(Names!R[-1]C[-17],MATCH(R[14]C[451],Names!R[-2]C[-17],0)) & ", " & INDEX(Names!RC[-17],MATCH(R[14]C[451],Names!R[-2]C[-17],0)),"")

What am I doing wrong?
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Thank you so much. I knew there was a simple answer.

I'm familiar with the absolute references and the relative references in []. How do I correctly tell it to look in the current row. Would that be [0]? I use that same kind of formula in several other routines.

What would be the correct syntax for my 2003 line of code?
Sheets("Student Report").Cells(3, 20) = "=IF(RC17<>0,INDEX(Names!C2,MATCH(RC17,Names!C1,0)) & "", "" & INDEX(Names!C3,MATCH(RC17,Names!C1,0)),"""")"
 
Upvote 0
Let me answer my own question.

Sheets("Student Report").Cells(3, 20).FormulaR1C1 = "=IF(RC17<>0,INDEX(Names!C2,MATCH(RC17,Names!C1,0)) & "", "" & INDEX(Names!C3,MATCH(RC17,Names!C1,0)),"""")

Thanks again for your help. It would have taken me ages to identify this simple syntax issue as the reason.

Thank you so much. I knew there was a simple answer.

I'm familiar with the absolute references and the relative references in []. How do I correctly tell it to look in the current row. Would that be [0]? I use that same kind of formula in several other routines.

What would be the correct syntax for my 2003 line of code?
Sheets("Student Report").Cells(3, 20) = "=IF(RC17<>0,INDEX(Names!C2,MATCH(RC17,Names!C1,0)) & "", "" & INDEX(Names!C3,MATCH(RC17,Names!C1,0)),"""")"
 
Upvote 0
RC17 is a reference to column Q in the current row.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,710
Members
452,939
Latest member
WCrawford

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