Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
787 views
in Technique[技术] by (71.8m points)

excel - Automatically link to a cell in another sheet if value is the same

I have a status update sheet (sheet1) in which team members have a line per action, and each action has a reference number (s1, columnA).

enter image description here

In another sheet (sheet2), I have the team leads write their own status updates, but they may not necessarily reference every single reference number, nor will they do it in the same order as sheet1.

enter image description here

Basically, what I'm looking for is a column in sheet1 to show a link automatically IF the reference number in columnA sheet1 is also found somewhere in columnB in sheet2.

Is this possible? If so, how would I work this? I'm hoping to use a formula, but I'm not sure if that's possible. Hoping to use VBA as a last resort since this will be a shared spreadsheet and the probability that someone might screw it up is decent.

Thank you, and please let me know if I should clarify anything.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

What you are looking for is a dynamic hyperlink.

So, let's assume that you have on Sheet1 all the

  • team members with the (column B)
  • team leads and the (column A)
  • reference / project numbers (column C).

On Sheet2 we have a table with various information and the same reference / project number in column E.

Then you can add a new column D to the table on Sheet1 which you might want to name Links and the formula here should be:

=HYPERLINK("#Sheet2!E"&MATCH(D2,Sheet2!E:E,0),"Link to "&D2)

If you are using tables with named columns that you can also use:

=HYPERLINK("#Sheet2!E"&MATCH([@[Reference Number]],Sheet2!E:E,0),"Link to "&[@[Reference Number]])

Of course you can adjust the alternative text to something more suitable.

Maybe the following picture helps explaining the above:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...