Here is a link that should help. It is very good with a sheet to calculate it and provides some examples.
https://networks.nokia.com/investors/tax-basis-worksheets
When I click on the link it says "Page not found" Do you have
any additional information?