Forum Discussion
Hyperlink function do not support Dynamic Arrays
Hi,
tried a very simple sheet where cell a1..a3 are links and cells b1..b3 are friendly names
the formula hyperlink(a1:a3,b1:b3) shows the hyperlinks correctly but not the friendly names
anyone have a workaround?
thanks in advance
10 Replies
- lori_mIron Contributor
For future reference: based on comments below, a method to spill any HYPERLINK formula of the form,
=HYPERLINK(link_location,friendly_name)
is to wrap link_location in an INDEX function:
=HYPERLINK( INDEX(link_location, ROW()-ROW(RC)+1, COLUMN()-COLUMN(RC)+1), friendly_name )
Note: this formula is given in RC-notation so that RC refers to the formula cell e.g. G4. In the general case link_location and friendly_name may be 2D calculated arrays and the formula may be freely moved around
- m_tarlerBronze Contributor
So I am having this problem also and this INDEX( [array_of_links], XMATCH( [array], [array] ) ) seemed to be the closest to working for me. There is another discussion a couple years 'newer' with some interesting approaches but I couldn't get them to work either (hyperlink-function-works-as-flash-fill-but-not-as-dynamicspill-array). But playing around with this INDEX idea I got the following to work:
=TAKE(HYPERLINK( INDEX(HSTACK( "#"&ADDRESS(ROW(A1#),COLUMN(A1#)), B1#), XMATCH(A1#,A1#), {1,2})) ,,-1)
So this will link to the cells in A1# using the friendly names in B1#
basically this 'STACKS' the link addresses (row3) with the friendly names (row4)
then it uses the XMATCH trick (row5) to make and array that works with HYPERLINK
row 6 makes INDEX return BOTH the address name and the friendly name but both apparently are linked to the correct cell
row 7 is part of the TAKE to only keep the friendly name column.
I hope this solution may be useful for anyone else having this problem.
- lori_mIron Contributor
Thanks for sharing - no way I'd ever have thought of that! This INDEX method seems to provide a generic approach for spilling a HYPERLINK formula with column arrays in both arguments. To improve efficiency I guess you could replace the XMATCH part with a range id column (C1#).
My approach would have been to make the link_location parameter relative to the current row, e.g.
=HYPERLINK("#"&ADDRESS(ROW(),COLUMN(A1#)),B1#) =HYPERLINK("#r[0]c"&COLUMN(A1#), B1#)
These both look ok on office desktop but the second one seems to have an issue on web version.
- m_tarlerBronze Contributor
I will have to remember to also test on the web version.
As for the XMATCH that seemed to be part of the 'trick' to make it work but I will have to try the ROW(). In my actual case it was even more complicated because I wanted a TRANSPOSE to also happen so the link spill was in a row while the link targets was in a column.
- lori_mIron Contributor
Maybe try inserting an @ symbol:
=HYPERLINK(@A1:A3,B1:B3)
To make backward compatible perhaps use a relative name ThisRow:=R (in R1C1 notation):
=HYPERLINK(ThisRow A1:A3,B1:B3)
Note the Function Wizard can provide clues to the behaviour in such cases. Without using an intersection operator one sees arrays in the Friendly name and Result but not Link_Location:
Using bold type for arrays the function could therefore be written as:
HYPERLINK(Link_Location, Friendly_name)
Entering an array in Link_Location results in a nested array which gets truncated by the calc engine.
Compare with a function like CONCATENATE which only shows single value results:
CONCATENATE(Text1,[Text2],...)
Then arrays are handled in the normal way.
Not sure why HYPERLINK has this signature, perhaps it was originally designed to allow for text inputs longer than 255 characters in Excel 2003 versions and prior?
- Andrew PhillipsCopper Contributor
lori_m
Wrap the hyperlink function around an index array function.
for example, where SHEETNAMES is an Array of the form $A$1# containing an array of sheet names for the workbook:=HYPERLINK(INDEX(CONCATENATE("#'",SHEETNAMES,"'!A1"),1,XMATCH(SHEETNAMES,SHEETNAMES,0)))
this however wont create the automatic formatting for a hyperlink, you may need a conditional format to achieve this.
I can't answer why this works, but it worked for me (Office 365)- lori_mIron Contributor
That's an interesting observation. For me this version also works fine:
=HYPERLINK(CONCATENATE("#'",SHEETNAMES,"'!A1"))
but replacing the SHEETNAMES range reference with an array such as {"Sheet1","Sheet2","Sheet3"} doesn't preserve spilled links. The INDEX suggestion also doesn't solve the posted question for me i.e. spilling friendly name.
- NikolinoDEGold Contributor
...to the fast :))
=hyperlink(a1:a3,b1)
or use Dynamic Hyperlinks
...see the attached file.
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.
- FabMs19Copper ContributorHi
did you find a solution or workaround?
thx in advance!