Hello adamoksbjerg,
Welcome to the Microsoft Community.
What kind of Office subscription do you have, the reason I ask is because the STOCKHISTORY function is only available to Microsoft 365 subscribers.
If you do not have an eligible subscription you will be blocked from using this function.

As an initial guess, it may have something to do with the license type, if you already have a Microsoft 365 subscription that means this is not the cause, please continue to reply and we will provide further support!
Best regards,
Ian - MSFT | Microsoft Community Support Specialist