Convert formula to Formula R1C1

p9j123

Active Member
Joined
Apr 15, 2014
Messages
288
Office Version
  1. 2013
Platform
  1. Windows
I have a dynamic formula and it is working just fine, however I want it to be converted to R1C1 formula. Can you please help me with this?

Cells(5, 7).Formula = "=VLOOKUP(F5,'[" & Range("A1").Value & "]Job Tracker'!$E$1:$F$" & a & ",2,0)"
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
One easy way is to turn on the Macro Recorder and record yourself entering the formula in the cell on the Excel worksheet.
By default, it records the formula using R1C1 format.
 
Upvote 0
There are some dynamic component that cannot be recorded by the macro.
 
Upvote 0
There are some dynamic component that cannot be recorded by the macro.
No, but it is easy enough to modify the formula after recording it!
To me, that part is much easier than coming up with the R1C1 part (not that it is hard, I just always confuse the absolute vs. relative range references and how to write them).

Otherwise, read this: https://bettersolutions.com/excel/formulas/cell-references-a1-r1c1-notation.htm

I prefer to let Excel do most of the work (through Macro Recorder), and then just modify to suit my needs.
 
Upvote 0
Try this.
Code:
Cells(5, 7).FormulaR1C1 = "=VLOOKUP(RC[-1],'[" & Range("A1").Value & "]Job Tracker'!R1C5:R" & a & "C6,2,0)"
 
Upvote 0
Something like
Code:
Dim a1Formula As String, r1c1Formula As String
    
a1Formula = "=A1+$B$1"
    
r1c1Formula = Application.ConvertFormula(a1Formula, xlA1, xlR1C1)

The thing about that is the relative references have to be in relation to some cell.

=A1 in B1 converts to =RC[-1], but if it were in C1 it would be =RC[-2].

The ConvertFormula function takes a RelativeTo argument, which defaults to the active cell.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

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