Ratio of Fields from Different Sheets in Excel Pivot

AI Thread Summary
To compute the ratio of two fields A and B from different sheets in Excel, users can create two pivot tables and reference their underlying cell values instead of clicking on the pivot cells. This involves using formulas that include cell references from both sheets, allowing for the use of VLOOKUPs to retrieve necessary values before performing the division. Challenges arise due to the need for matching instances across the tables, particularly since field B is an aggregate, complicating the process further. Some users express frustration with Excel's limitations compared to programming languages like Python, which offer more straightforward solutions. Overall, while the task is feasible, it requires careful handling of pivot tables and formulas.
WWGD
Science Advisor
Homework Helper
Messages
7,678
Reaction score
12,374
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: 837
Computer science news on Phys.org
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.
 
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.
 
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
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 )
 
In my discussions elsewhere, I've noticed a lot of disagreement regarding AI. A question that comes up is, "Is AI hype?" Unfortunately, when this question is asked, the one asking, as far as I can tell, may mean one of three things which can lead to lots of confusion. I'll list them out now for clarity. 1. Can AI do everything a human can do and how close are we to that? 2. Are corporations and governments using the promise of AI to gain more power for themselves? 3. Are AI and transhumans...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...
Back
Top