Hello. I am trying to automate a formula using a pivot table and vba. As you can see in the image, there are several company names will change as well as the year and amounts but the supplies and tax categories will remain the same. I want to have a designated area like below each pivot table where I can run a macro to search the pivot table and come up with a formula similar to
=GETPIVOTDATA("totals",$A$3,"Year",2019,"company","pizza co","cost type","tax")/GETPIVOTDATA("totals",$A$3,"Year",2019,"company","pizza co","cost type","supplies")
where the tax is divided by the salary and then formatted as a percent.
I want to ensure the formula is run for each company and put in the correct place for the corresponding year. Is this possible, or would it be better to use the data sheet to automate the formula?
Thank you for any assistance!
=GETPIVOTDATA("totals",$A$3,"Year",2019,"company","pizza co","cost type","tax")/GETPIVOTDATA("totals",$A$3,"Year",2019,"company","pizza co","cost type","supplies")
where the tax is divided by the salary and then formatted as a percent.
I want to ensure the formula is run for each company and put in the correct place for the corresponding year. Is this possible, or would it be better to use the data sheet to automate the formula?
Thank you for any assistance!