Ratio of Fields from Different Sheets in Excel Pivot

In summary, the conversation discusses the challenge of computing the ratio of two fields A and B from different sheets in the same workbook using Pivot or Excel. The speaker has tried using the Wizard and Microsoft Query, but encountered difficulties. They then proposed a solution involving creating a formula that references two pivot tables and using vlookups to grab the values needed for the computation. However, they also mention the limitations of using spreadsheets for this task and the need for extra care when dealing with pivot tables.
  • #1
WWGD
Science Advisor
Gold Member
7,372
11,336
Hi All,
I want to compute the ratio of two fields A,B from different sheets ( same workbook)
, using Pivot ( tho "straight" Excel will do*). I tried using the Wizard, but , in the end, could
not find a way of doing it:

upload_2018-1-23_20-52-41.png


Any ideas, please?
*I scewed big when trying this.
 

Attachments

  • upload_2018-1-23_20-52-41.png
    upload_2018-1-23_20-52-41.png
    66.2 KB · Views: 806
Computer science news on Phys.org
  • #2
Can you explain a bit more? I could possibly find a clean way to do this, though I already have a few hacks in mind.
 
  • #3
Thanks. I have two fields A,B given, both in the same workbook, although in different sheets, and I need to compute the field C:=A/B within Excel. It is a bit more problematic in that I do need to find the values of A,B for the same instance, say ##i## in both tables, so that I need something like a join, to make sure I compute ##A_i/B_i## instead of ##A_i/B_j ; j \neq i ##. Because of complicated reasons, I cannot do it within SQL. I tried to use Microsoft Query, but the connection was poor ( strangely so, given I could export data to/from SQL Server from Excel, and , of course, SQL server was running.); so I cannot " pullback" query results from Microsoft Query back to Excel.
 
  • #4
I think this is going to be hard to explain over text as excel cells aren't quite standardized enough... (if you were using pandas or numpy in python things are almost taylor made for forum correspondence-- it really would be as simple as dropping in a couple lines of code... )

Does the below sketch work?
- - - -
you have two pivot tables. Linking to pivots is the same as as with regular cells excel if you 'click' the pivot cell it won't have a regular cell reference. You want underlying cell references, so don't click them. So on a new worksheet tab, you want to create a formula that references the two pivot tables-- here in your references you type in cell formula (in your picture the cells would be something like "$Sheet4!A$4: $Sheet4!?$?") for both of your arrays. you grab the values you want by vlookups, and then divide things as needed.

- - - -
I felt uncomfortable while writing that as it seems we have the wrong tool for the job on two levels here (i.e. explaining this by text with clunky excel interface -- maybe a youtube video would be ok though) and I get less and less happy with spreadsheets as the right tool for anything, but I digress.

Some extra care is needed in dealing with pivot tables, on a few different levels. Not sure how much that helps.
 
  • Like
Likes WWGD
  • #5
StoneTemplePython said:
I think this is going to be hard to explain over text as excel cells aren't quite standardized enough... (if you were using pandas or numpy in python things are almost taylor made for forum correspondence-- it really would be as simple as dropping in a couple lines of code... )

Does the below sketch work?
- - - -
you have two pivot tables. Linking to pivots is the same as as with regular cells excel if you 'click' the pivot cell it won't have a regular cell reference. You want underlying cell references, so don't click them. So on a new worksheet tab, you want to create a formula that references the two pivot tables-- here in your references you type in cell formula (in your picture the cells would be something like "$Sheet4!A$4: $Sheet4!?$?") for both of your arrays. you grab the values you want by vlookups, and then divide things as needed.

- - - -
I felt uncomfortable while writing that as it seems we have the wrong tool for the job on two levels here (i.e. explaining this by text with clunky excel interface -- maybe a youtube video would be ok though) and I get less and less happy with spreadsheets as the right tool for anything, but I digress.

Some extra care is needed in dealing with pivot tables, on a few different levels. Not sure how much that helps.

Thanks, and sorry I forgot to include this: What makes the ratio A/B more complicated is that B is an aggregate, making a SQL query clunkier ( needing to do group by' s )
 

FAQ: Ratio of Fields from Different Sheets in Excel Pivot

What is the "Ratio of Fields from Different Sheets" in Excel Pivot?

The "Ratio of Fields from Different Sheets" in Excel Pivot is a feature that allows users to compare data from different sheets in a pivot table. It calculates the percentage or ratio of one field's values to another field's values.

How do I use the "Ratio of Fields from Different Sheets" in Excel Pivot?

To use the "Ratio of Fields from Different Sheets" in Excel Pivot, first create a pivot table and add the fields you want to compare. Then, right-click on the field you want to use as the numerator and select "Show Values As" > "% of Field" > "Other Sheet". Next, select the sheet and field you want to use as the denominator. The pivot table will now display the ratio or percentage of the two fields.

Can I change the calculation method for the "Ratio of Fields from Different Sheets" in Excel Pivot?

Yes, you can change the calculation method for the "Ratio of Fields from Different Sheets" in Excel Pivot. Right-click on the field you want to change and select "Show Values As" > "Value Field Settings". From there, you can choose from various calculation methods such as sum, average, count, etc.

What if I want to compare fields from different workbooks in Excel Pivot?

You can use the "Ratio of Fields from Different Sheets" feature to compare fields from different workbooks in Excel Pivot. Simply click on the "Browse" button next to the sheet name and select the workbook and sheet you want to use as the denominator.

Is there a limit to the number of fields I can compare using the "Ratio of Fields from Different Sheets" in Excel Pivot?

No, there is no limit to the number of fields you can compare using the "Ratio of Fields from Different Sheets" in Excel Pivot. You can compare as many fields as you want as long as they are in the same pivot table and you have enough space to display the results.

Similar threads

Replies
9
Views
2K
Replies
5
Views
1K
Replies
31
Views
3K
Replies
20
Views
2K
Replies
1
Views
1K
Replies
4
Views
3K
Replies
10
Views
1K
Back
Top