How to store excel formula answer to variable?

ke9c

Board Regular
Joined
Jul 27, 2010
Messages
75
how to set below formula into an variable instead of cell formula?
"=VLOOKUP(RC[-1],Range("A1:A10",3,FALSE)"


i want to do dim i as integer
i="=VLOOKUP(RC[-1],Range("A1:A10",3,FALSE)"
 

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Sandeep Warrier

Board Regularmmmm Pizza
Joined
Oct 31, 2008
Messages
2,672
Use Evaluate

i = Evaluate("VLOOKUP(Sheet1!A2,Sheet1!A1:C10,3,0)")

Change ranges to suit needs.
 

ke9c

Board Regular
Joined
Jul 27, 2010
Messages
75
Use Evaluate

i = Evaluate("VLOOKUP(Sheet1!A2,Sheet1!A1:C10,3,0)")

Change ranges to suit needs.
thanks, i use below but doesnt work, can advise? srOverrideTicker is a range name
i = Evaluate("VLOOKUP(RC[-1],srOverrideTicker,3,0)")
 

Sandeep Warrier

Board Regularmmmm Pizza
Joined
Oct 31, 2008
Messages
2,672
I'm not very familiar with Evaluate()... but I don't think you can use RC[-1] in it. You'll have to replace it with cell names, for example A1.
 

gsbelbin

Active Member
Joined
Aug 29, 2008
Messages
336
how to set below formula into an variable instead of cell formula?
"=VLOOKUP(RC[-1],Range("A1:A10",3,FALSE)"


i want to do dim i as integer
i="=VLOOKUP(RC[-1],Range("A1:A10",3,FALSE)"
You could use i=WorksheetFunction.VLOOKUP( ...

but I'm not sure that you can use RC[-1]. This is a relative reference, what is it relative to?
 
Last edited:

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,456
Messages
5,511,492
Members
408,853
Latest member
JoshuaHudsonpTi45

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top