Zend certified PHP/Magento developer

Including hyperlink in an If statement returns true causing all cells that return false to link to a 404 not found webpage

I have a fairly convoluted formula but for the problem at hand, it really only concerns the 2nd If statement.

=IF(OR($H24="",I$18=""),"",IF(I$18="Additional Notes",IF(ISERROR(MATCH($H24,AdditionalNotes!$H$16:$H445,0)),"",
HYPERLINK("#AdditionalNotes!I"&MATCH($H24,AdditionalNotes!$H:$H,0),"Additional Notes")),


IF(INDEX(MasterSheet!$B$4:$AG$500,MATCH($H24,MasterSheet!$D$4:$D$500,0),
MATCH(I$18,MasterSheet!$B$4:$CF$4,0))=0,"",INDEX(MasterSheet!$B$4:$AG$500,
MATCH($H24,MasterSheet!$D$4:$D$500,0),
MATCH(I$18,MasterSheet!$B$4:$CF$4,0)))))

Basically, if a column contains “Additional notes”, it’ll search a sheet called AdditionalNotes for a name. If that name exists, then I use a match function to find the location and include a hyperlink.

I got it to work correctly, except I’ve know spent about an hour trying to figure out why every other cell that has a value has turned into a link. It’ll open up a page in my browser trying to find something in my sharepoint and will just say 404 not found.

Even if i just change the formula to this just be a basic hyperlink, the problem persists

=IF(OR($H21="",J$18=""),"",IF(J$18="Additional Notes",HYPERLINK(H3,"Additional Notes")

anyone have any idea why this would be happening? any help is greatly appreciated.

Thank you

Also -If someone has an idea on how to correctly insert the formula so it doesnt need a scroll other than just pressing enter and putting each line as a separate code block, please share. I know that’s annoying so apolgies