This is a unique (as far as I can see) Excel function, in that the evaluation result is one thing, but the function has a second value required for implementation in a client.
The first argument to the function is the target URL, the second argument is optional display text. The current implementation returns the display text, if present, as the function value. This is correct, as that's the value displayed, but if you want to actually implement a link, one needs the URL argument also. There currently is no way I can see to easily get that. I see 5 years ago it was possible to override POI function implementations, which allowed a hacky way to get at the value [1]. This is not available in 3.17 or 4.0.x. I'm not finding a quick or simple-enough-to-be-satisfactorily-stable way to get at that first arg when two are present in a cell formula. Especially if the argument is built from a complex formula, as is often the case with URLs, as sanitization and escaping are needed. I'd be satisfied with a way to override a function implementation for a given evaluation run only, or even parse the formula to find function objects and their arguments. However, the process to get from a Ptg[] to a function call and arguments involves a complex evaluation loop in OperationEvaluationContext, and I'm not excited about messing with that. For now I think I'll have to live with parsing the formula string to extract the argument text and evaluating it to get the URL. For a future POI release, two ideas I've had so far, worth discussing, are: A. Hyperlink function evaluation returns subclasses of the input ValueEval that references the "other" relevant value. Could be used by other functions with similar side effect requirements, if there are any. B. Add a default "ValueEval get|setOtherValue()" methods to the ValueEval interface that do nothing and return null, and override it in implementing classes. Hyperlink and other functions would set the "Other" value as needed. I'm not in love with either solution, but that's what I've got so far. Greg [1] https://stackoverflow.com/questions/15757243