summaryrefslogtreecommitdiff
path: root/calc.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2022-06-24 01:03:19 +0800
committerxuri <xuri.me@gmail.com>2022-06-24 01:03:19 +0800
commit2e1b0efadc0519fa4572b2437401bf2993366a07 (patch)
tree8af25079777593916bfd4e40febea172d094a1f7 /calc.go
parent61c71caf4fdd056a45c69d8f3aea2231da2c074a (diff)
ref #65, new formula function: HYPERLINK
Diffstat (limited to 'calc.go')
-rw-r--r--calc.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/calc.go b/calc.go
index c71cd10..d9bf653 100644
--- a/calc.go
+++ b/calc.go
@@ -14514,6 +14514,21 @@ func (fn *formulaFuncs) HLOOKUP(argsList *list.List) formulaArg {
return newErrorFormulaArg(formulaErrorNA, "HLOOKUP no result found")
}
+// HYPERLINK function creates a hyperlink to a specified location. The syntax
+// of the function is:
+//
+// HYPERLINK(link_location,[friendly_name])
+//
+func (fn *formulaFuncs) HYPERLINK(argsList *list.List) formulaArg {
+ if argsList.Len() < 1 {
+ return newErrorFormulaArg(formulaErrorVALUE, "HYPERLINK requires at least 1 argument")
+ }
+ if argsList.Len() > 2 {
+ return newErrorFormulaArg(formulaErrorVALUE, "HYPERLINK allows at most 2 arguments")
+ }
+ return newStringFormulaArg(argsList.Back().Value.(formulaArg).Value())
+}
+
// calcMatch returns the position of the value by given match type, criteria
// and lookup array for the formula function MATCH.
func calcMatch(matchType int, criteria *formulaCriteria, lookupArray []formulaArg) formulaArg {