Excel:需要<a href=""> in if statement to be recognized as string not formula

时间:2018-12-23 18:49:45

标签: excel excel-formula

        +---+------------------+-----------------+---------+
        |   |        A         |        B        |    C    |
        +---+------------------+-----------------+---------+
        | 1 |   Link Reference |   Description   |    ID   |
        +---+------------------+-----------------+---------+
        | 2 |      Result      |    East Quad    |    2    |
        +---+------------------+-----------------+---------+

Hey guys,

In Excel, I want to output for cell A2 [Result] the following

     <a href="http://www.google.com">East Quad</a>

I'm using this formula below.

     Result=IF(C2="2","<a href="https://www.google.com">B2</a>,"Null")

However, after pressing enter I get an error...

     Result=IF(C2="2","<a href=**"https**://www.google.com">B2</a>,"Null")

"https gets highlighted. I think this is occurring because Excel is interpreting href= as a formula.

I thought maybe adding before it something as TEXT() or STRING() would work, but I wasn't able to get anywhere.

Does anyone know what I could add in order for this error not to prop up, or could it also be a setting within the application that needs to be adjusted?

Thank you!

1 个答案:

答案 0 :(得分:1)

A2 中输入:

=IF(C2="2","<a href=""https://www.google.com"">" & B2 & "</a>","Null")

enter image description here

此公式假定单元格 C2 包含 Text 2 而不是 Numeric 2

请注意双引号的用法。