Excel conditional Hyperlink outputs the Hyperlink for both conditions

十年热恋 提交于 2019-12-19 08:13:13

问题


I think I must be going mad here, what I want to do is to write a simple Excel formula that performs an IF test, and if the result is false I want to hyperlink some text, if it is true I want to display some text which is not hyperlinked.

So for example -

=IF(1=1,"1",HYPERLINK("2"))

this returns 1 as you would expect, but the 1 is hyperlinked - I only want to hyperlink if the value is 2.

Surely this is possible? Thanks in advance for any advice!


回答1:


Update:

Oh, I was wrong. I checked into it and this happens because when Excel sees the 'Hyperlink' function in a cell it turns the entire cell into a 'followable' cell so that links will work.

The work around to avoiding the error message "The address of the site is not valid" (which occurs when the hyperlink is turned on for the cell but the link has nowhere to go)... is to give excel a link that goes nowhere by referencing the cell address of the formula.

Example to paste into cell A1:

=IF(1=2,HYPERLINK("#"&CELL("address",A1),"1"),HYPERLINK("C:\","2"))


来源:https://stackoverflow.com/questions/11363263/excel-conditional-hyperlink-outputs-the-hyperlink-for-both-conditions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!