using user vlookup to return a formula where the row number component is always the current row

AndrewI

New Member
Joined
Nov 1, 2017
Messages
40
Hi everyone. Thanks in advance for reading this.
I'm trying to use VLOOKUP to return formula which it retreives from a table on a different tab. When the VLOOKUP is row 10, the formula would be (AB10/P10)*1000.
The difficulty i'm having is that when the row the VLOOKUP changes, the rows in the formula should match the current row, so in row 11 it would be (AB11/P11)*1000.

Now obviously i can't build the lookup table to account for every row so wondering how I'd construct that formula?
I'm then using the UDF "EVALUATETXT" (see below) to evaluate that text as if it were a formula. I keep getting #VALUE and #REF errors with every method I try.

UDF code:
Function EVALUATETXT(s As String) As Variant
Application.Volatile
EVALUATETXT = Application.EVALUATE(s)
End Function


Thanks
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
this is as close as I can get (changed the column refs as I am testing on the same tab as the table so i can show you guys .
The result in the focused cell should be 3.33333 and not the formula text

Thanks
1574836231695.png
 
Upvote 0
sorry.. also, if i "EVALUATETXT" that result in a different cell i get the right answer, but if I try to nest it all in one cell ie (EVALUATETXT(EVALUATETXT(ref) i get a #value error
 
Upvote 0
Hi everyone. Thanks in advance for reading this.
I'm trying to use VLOOKUP to return formula which it retreives from a table on a different tab. When the VLOOKUP is row 10, the formula would be (AB10/P10)*1000.
The difficulty i'm having is that when the row the VLOOKUP changes, the rows in the formula should match the current row, so in row 11 it would be (AB11/P11)*1000.

Now obviously i can't build the lookup table to account for every row so wondering how I'd construct that formula?
I'm then using the UDF "EVALUATETXT" (see below) to evaluate that text as if it were a formula. I keep getting #VALUE and #REF errors with every method I try.

UDF code:
Function EVALUATETXT(s As String) As Variant
Application.Volatile
EVALUATETXT = Application.EVALUATE(s)
End Function


Thanks
Any help warmly received
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,823
Members
452,946
Latest member
JoseDavid

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