How to combine vlookup and hyperlink function? - excel

I am trying to have the values that my vlookup function returns act as a hyperlink that will go to the value it pulled from another sheet in the same workbook.
There are thousands of lines that I need to hyperlink and I can't go one by one, right clicking and manually changing them.
If anyone has advice to solve this problem, please let me know. Below is my vlookp formula.
=VLOOKUP(A:A,'Cost Estimates'!A:C,3,FALSE)

To list address of the matching cell, you can do this:
=ADDRESS(MATCH(A1,'Cost Estimates'!A:A),3,1,1,"Cost Estimates")
But this won't create a hyperlink, just a visible address.

You can use:
=VLOOKUP(A1,'Cost Estimates'!A:C,3,FALSE)
to return the column C value corresponding to A1.
Then use:
=MATCH(VLOOKUP_RETURN,C:C,0)
to get the index of that in column C.
Then use:
="#'Cost Estimates'!C"&INDEX_VALUE
to build a hyperlink address.
Finally, you can use HYPERLINK to construct the hyperlink. Putting it all together in a single formula:
=HYPERLINK("#Cost Estimates!C"&MATCH(VLOOKUP(A1,'Cost Estimates'!A:C,3,FALSE),'Cost Estimates'!C:C,0),VLOOKUP(A1,'Cost Estimates'!A:C,3,FALSE))
Hope that does the trick.

Related

How can I make a criteria in an excel forumla reference text in another cell?

I am using a SUMIFs formula in excel. One of my criteria consists of text, but the text will vary for every row I am applying this formula too. Rather than typing out that text for each column, I'd like to find a way to include in my formula the reference for where that text comes from, and have excel grab it for each row.
This picture shows what I am currently working with.
The last term in the formula is "BT-107-141-1". That is also the value of A2 in this sheet. Rather than typing "BT-107-141-1" (and doing the same thing for every row I have), can I direct excel to use whatever value is in A2 as the criteria in this formula?
I was trying to use INDIRECT, but couldn't get it to work. Something like "VALUE($A2)" might work?
Please let me know if you have any questions, I would really appreciate some help! Thanks.

Copying and Pasting Column with Concat not Working

I have one sheet in excel that I have concatenate values in. But when I try to copy the exact same column for another page it does not copy correctly. It goes from =CONCAT(A!C8,A!D8,"-",A!$F$5) to =CONCAT(A!A2,A!B2,"-",A!$F$5). How do I get it to keep the exact same formula? Thank you.
You know the difference between absolute an relative references in a formula right? The $ symbol before a column in a formula means when you copy to the next column it stays anchored to the original. Without it it becomes relative to the last one. Ditto rows. The only way you can do what I suspect you want is copy/paste the actual formula entry bar rather than the cell itself. If you copy across sheets you may get a sheet reference prefixed that you may or may not want to edit out after pasting. That's the A! in your example.. Sheet A.
Have you tried copy, then on the page you want to paste, "Right-Click" and choose "Paste Special" and choose "Formulas" ??

A formula to copy the values from a formula to another column

I have a column of values created from a formula, I know I can copy the values over to another column by using the clipboard. BUT...I want my spreadsheet to be automatic whilst avoiding the use of VBA coding, so it would be ideal if I could create a formula for the next column which copies the VALUES over to the next column. Maybe an INDEX/MATCH kind of method but one that copies ONLY the values rather than the formulas.
So in essence I want a formula to copy the values from a formula....
You can use =A4, in case A4 is having long formula
Use =concatenate(). Concatenate is generally used to combine the words of several cells into one, but if you only input one cell it will return that value. There are other methods, but I find this is the best because it is the only method that works when a formula, whose value you wish to return, is in a merged cell.
For such you must rely on VBA. You can't do it just with Excel functions.
you can use those functions together with iferror as a work around.
try =IFERROR(VALUE(A4),(CONCATENATE(A4)))
What about trying with VLOOKUP? The syntax is:
=VLOOKUP(cell you want to copy, range you want to copy, 1, FALSE).
It should do the trick.
Copy the cell. Paste special as link. Will update with original.
No formula though.

How do I use the result of one function in another function to get the value stored in a cell in another sheet in Excel?

In my current sheet I have some numbers in a column, which represent the row which I want to get the data from in another sheet. And I want to get it from the same column in which I am using the function...
I know using =Sheet1!A1 for instance gets me what is in A1 on Sheet1
and
=CONCATENATE("A",A1) being on sheet two, brings me back A + whatever value is stored in A1 on sheet number two... for simplicity let's say it's a one... so it would return A1
I am on Sheet2
I'm trying
=Sheet1!CONCATENATE("A", A1)
but the formula contains an error, I've tried rewriting this in many ways but it never works... any idea what the correct syntax I need is?
Greatly appreciated!
THanks
As Magicianeer said, you have to use the INDIRECT function. For your example:
=INDIRECT(CONCATENATE("Sheet1!","A",A1))
Should give the results you need.
However, it's a bit lengthy, and you can use & instead of CONCATENATE, and you can directly use Sheet1!A:
=INDIRECT("Sheet1!A"&A1)
What is evaluated in the brackets is Sheet1!A1, and INDIRECT converts this from text to a reference.
Try:
=CONCATENATE("A", Sheet1!A1)

using hyperlink in a vlookup function

very new to this and only just managed the vlookup, anyway,
i have a workbook which contains two Sheets. On Sheet1 I have the following formula (=VLOOKUP(CZ54,Sheet2!$A$1:$Y$176,3,FALSE)) which displays the ID number from Sheet2. This works correctly but how do I get to appear as a hyperlink so once clicked it goes to the specific cell it got from the vloopkup on Sheet2?
I have tried =HYPERLINK(VLOOKUP(CZ54,Sheet2!$A$1:$Y$176,3,FALSE) but I get the error "Cannot get the specified file".
I would be grateful if anyone can point me in the right direction, thank you.
Ok... this looks crazy. This should work for you. I tested it on my machine and it works:
=HYPERLINK(MID(CELL("filename"),SEARCH("[",CELL("filename")), SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))+1) & ADDRESS(MATCH(CZ54,Sheet2!$A$1:$A$176),3,,,"sheet2"),VLOOKUP(CZ54,Sheet2!$A$1:$Y$176,3,FALSE))
Let's break it up a little just to explain some of the parts:
MID(CELL("filename"),SEARCH("[",CELL("filename")), SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))+1)
Returns a string [currentFileName], which is the required format for a hyperlink within a workbook.
MATCH(CZ54,Sheet2!$A$1:$A$176),3,,,"sheet2")
Returns the row number of value of CZ54 in the first column of your VLookup range.
ADDRESS(MATCH(CZ54,Sheet2!$A$1:$A$176),3,,,"sheet2")
Returns the address of the row found, and the column(3, from your vlookup) in sheet2.
So combined:
MID(CELL("filename"),SEARCH("[",CELL("filename")), SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))+1) & ADDRESS(MATCH(CZ54,Sheet2!$A$1:$A$176),3,,,"sheet2")
Returns the actual address for the hyperlink, which is the first parameter of the HYPERLINK formula.
The second parameter is the Vlookup you provided, and voilĂ .
Edit: A warning if anyone tries to use this for a similar issue, if the lookup_array used in Match or Vlookup does not start with Row 1 or column 1 respectively, you will need to offset the values sent to ADDRESS with a +(starting row or column - 1). Example: Match(CZ54,$A$2:$A$176)+1 instead of MATCH(CZ54,Sheet2!$A$1:$A$176).
Here's a more compact version of Daniel's formula.
Using Hyperlink to link to another sheet in the same workbook, you can replace the reference to the workbook name with #.
Eg =HYPERLINK("#Sheet2!$C$10","Click Here")
So, applying this you get
=HYPERLINK("#"&ADDRESS(MATCH(E21,Sheet2!$A$1:$A$176),3,,,"sheet2"),VLOOKUP(E21,Sheet2!$A$1:$Y$176,3,FALSE))
HYPERLINK is looking for text so if you were to do something like
=HYPERLINK(left(VLOOKUP(CZ54,Sheet2!$A$1:$Y$176,3,FALSE),255))
it should return a usable hyperlink

Resources