formula in vba help

spq24

Board Regular
Joined
Jan 18, 2010
Messages
52
ActiveCell.FormulaR1C1 = "=IF(RC[-1]="""", """", RC[-16,1]/VLOOKUP('Sales Data'!RC[-22],'Regional Pipeline map'!R1C1:R4C29,3,FALSE))"


=IF(V2="","",G2/VLOOKUP('Sales Data'!A3,'Regional Pipeline map'!$A$1:$D$29,3,FALSE))


I need to create a formula like the 2nd formula. Above that is what I have written in VBA currently. Everything works currently except the vlookup in the formula is showing 'Sales Data'!A2 instead of 'Sales Data'!A3 (when it's in cell A2). Does anyone know how I can get it to go to cell A3?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Do you HAVE to use the R1C1 method? or is A1, B1 fine?

also, what cell is this going into?
 
Last edited:
Upvote 0
Try something like....
'Sales Data'!R[1]C[-22]

Alternatively, you can manually put your formula in a cell like you normally would, then go to Tools\Options|General and turn on the R1C1 reference style to convert the formula to R1C1 notation to use it in VBA.
 
Last edited:
Upvote 0
Sorry I forgot to mention that I need this to go down an entire data list. So when it's in cell A2 it will reference cell 'Sales Data'!A3 when it's in cell A3 it will reference cell 'Sales Data'!A4 etc. and this dataset will grow throughout the year so it needs to be able to grow with it
 
Upvote 0

Forum statistics

Threads
1,224,578
Messages
6,179,654
Members
452,934
Latest member
mm1t1

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