Reputation: 8360
I have defined the function:
Function TabName()
TabName = ActiveSheet.Name
End Function
When I type =TabName()
into a cell, I get the text tabname
in the cell, as you can see here:
But when I use the function in a cell like this:
I get the wrong result. The correct result is what I get if I "hardcode" the tab name in like in this screenshot:
Why is this, and what can I do to make my function work properly?
Upvotes: 0
Views: 47
Reputation: 7884
You get the wrong result because your =SUMIFS()
compares values to string value "=tabname()"
, not the result of function tabname()
. Try this:
=SUMIFS(Bokningar!E:E;Bokningar!B:B;TabName())-SUM(C:C)
Upvotes: 2