VLOOKUP VBA - both work but ?

SandsB

Well-known Member
Joined
Feb 13, 2007
Messages
731
Office Version
  1. 365
Platform
  1. Windows
"=IFNA(VLOOKUP(RC[-17],'Pending'!R2C[-18]:R200C[8],3,FALSE),"""")"
"=IFNA(VLOOKUP(RC[-18],'Pending'!RC[-19]:R[198]C[7],5,FALSE),"""")"

The first string was from a macro I recorded way back when. I added the IFNA. The second string is from a macro I recorded today. Both work but I'm trying to understand the different ways the cells are referenced? Is there a functional difference? Is one better than the other for some reason?
 

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".
R200 is row 200
R[198] is the row 198 down from the cell containing the formula
 
Upvote 0
Just to try and be a bit clearer, if we were putting the formula in cell E8 both codes below would reference H200

VBA Code:
Sub testR1()
Range("E8").FormulaR1C1 = "=R200C8"
End Sub
would give the Absolute reference of $H$200

Whereas
VBA Code:
Sub testR2()
Range("E8").FormulaR1C1 = "=R[192]C[3]"
End Sub
would give the Relative reference of H200

In your formula it would probably be better to have the lookup range as both absolute row and absolute column
 
Upvote 0

Forum statistics

Threads
1,223,992
Messages
6,175,829
Members
452,673
Latest member
LaMiaAvy

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