I have one table in Sheet1 with next data
and second table in Sheet2 with simular data
As you can see in first table in first row i have
Item No Loc Type Quantity
231 A 1 34
and in second table
Item No Loc Type Quantity
231 A 1 11
231 A 1 12
231 A 1 11
Quantity in first table is sum of quantity in second table group by
item No, Loc, Type.
How i can link quantity from first table when press 34 to open second table with data how i got this 34?
Any idea???
Use a Pivot Table with row field Layout and Print settings set to "Show item labels in tabular form".
This will give you a table like this:
When you double-click the "34" a new sheet will be added showing the source data rows used to calculate the total quantity:
Use =sumifs() function.
see image for more details
Related
I have a table with three columns, region, emp_name, salaries.
I want to add one more column to this table in excel.
That new column should have either 1 or 0. 1 indicates one of the top3 employee based on salaries in a particular region.
For example, Region1 has 7 employees, namely emp1, emp2, so on emp7. emp2, emp4, emp7 have top 3 salaries.
So in the new column, emp2, emp4, emp7 must have 1 and others have 0. Let's say this table contains n number of regions.
Put this in D2 and copy down:
=IF(C2>=AGGREGATE(14,7,$C$2:$C$1000/($A$2:$A$1000=A2),MIN(COUNTIF(A:A,A2),3)),1,0)
Use a pivot table
Insert the pivot using your whole range
Add Region/Employee to Rows field (In that order)
Add Salary (SUM) to the Values field
Below Pivot Table Design = No Subtotals, No Grandtotals, Tabular Layout
Select the drop down on Employee, Select Value Filter, Select Top 10...
Complete form with Top 3 Items by Sum of Salary
If a region does not have 3 options, the top n will appear where n < 3.
If you need to use the 1, 0 option you could just do a vlookup on this table too. Note that a error will return if they are not on this list which means they are not top 3. You can use some error handling to convert this to 1, 0
let's say i have folowing data for my excel pivot table:
country_id user_id answer
---------- ------- ------
1 1 Y
1 2 Y
2 3 N
2 4 Y
3 5 N
i would like to count how many "Y" i have per country.
If i put "answer" in Values as "Count of answer" i get 1 for each row. How can i count only "Y" answers?
so the result will be:
country_id answerY
----------- -------
1 2
2 1
3 0
br
Y
I have a solution similar to #pkg. Add one more column in your data and call it "answerY" with the formula:
=IF(C4="Y",1,0)
or, if your data is in a table:
=IF([#answer]="Y",1,0)
Now, set up your pivot table as follows:
Row lables: country
Values: answerY (sum)
Ordinarily I'd say to add a calculated field in a pivot table, but calculated fields work off of the aggregate values, and I can't think of a way to do this with a straight pivot table.
If you have the ability to use PowerPivot, you could create a custom column or a Dax expression that would handle this.
I'm not sure you can do that in a pivot table, but if you would like to do it outside of a pivot table you could make a couple of columns with these formulas:
Column D:
=IF(C2="Y",1,0)*A2
Column E:
=COUNTIF(D$2:D$6,B2)
This assumes that all user IDs are unique and sequential, and D$6 needs to be replaced with whatever is the last value in the column. Column E will have the values you described as answerY.
I have a table in Excel with 2 columns. Column A (Owner) has a list of names. Column B (Duration) has a list of numbers. I need to get the average of numbers for each of the owner. So for James it would be (4 + 5 + 18) / 3. I know how to get the average in Excel but I don't know how to conditional say:
Use the value in Column B if value in A = "James"
A B
---------------
Owner Duration
James 4
Dan 67
Ger 3
James 5
Ger 75
James 18
The AVERAGEIF function will allow you to do this.
=AVERAGEIF(A2:A7,"James",B2:B7)
The first argument is the range which will be subject to the criteria
The second argument is the criteria.
The third argument is the range (corresponding to the first range) with values to be averaged.
There is also a SUMIF, COUNTIF, and others.
You will need to do this in a pivot table.
Select all your data.
Go to Insert >> pivot table >> click ok
Select both columns (COLA, COLB) from the list of fields
available on the right.
By default COLB will go under VALUES.
Click on the arrow that says Sum of COLB >> click on value field
settings >> Select Average function instead of sum.
Check this link https://support.office.com/en-us/article/Create-or-delete-a-PivotTable-or-PivotChart-report-d09e4d07-8cd6-4b60-afad-8fb67418800f?CorrelationId=78b545a8-649b-400a-9941-a23ef409c95b&ui=en-US&rs=en-US&ad=US#_Toc263767342 for more info on pivot tables
I have two columns in Excel as follows:
col1 col2
1 10
1 22
1 11
1 23
1 14
2 16
2 12
2 10
2 9
How do I write a command to returns the maximum value from col2 corresponding to each unique value in col1?
So here I need to write a command to get 23 and 16.
The data I have shown here are dummies; I have 600 unique values in col1 in my actual data set.
Pivot tables: the single most underutilized and powerful feature of excel.
File menu:
Insert
Pivot Table
Select range
Fill in as indicated in image below
Step by Step:
Place cursor in cell to right of all data on sheet.
Select insert from menu
select pivot table icon
select pivot table from pop-up of icon
use the button to select the range of cells included (all 600+ rows in 2 columns) (or just enter $A:$B)
select ok
A pivot table field list appears on the right:
Drag and drop row 1 into row labels.
drag and drop row 2 into values area.
left click on "... of Row 2"
select value field settings
select "Max" instead of count or sum
select ok and you should have desired results.
The pivot table will find the max value in row 2 for each unique value in row 1 which is what I believe you are after.
Even if a solution has been found. I think it is too complicated and oversized to use the pivot for this and it might not be possible in all scenarios. Here is one that can be found searching the internet for "max if excel" (e.g. see here; adapted)
{=MAX(IF(A:A=A1,B:B))}
Attention! This is an array formula, you have to enter it without the curly brackets and then press Ctrl+Shift+Enter to submit the formula.
Since the left hand values seem to be in order, Subtotal should work.
The goal is to create a formatted balance Sheet based on information (data dump) off of the database.
Download Excel File
There are 2 worsheets
Work Sheet 1: Raw Data Sheet
Column A Column B
Grp 1 Name 1
Grp 1 Name 2
Grp 2 Name 45
I need to populate Work Sheet 2 as
Column A Column B
Grp 1
Name 1
Name 2
Total Grp 1:
Grp 2
Name 45
Total Grp 2
This needs to be automated such that if a new Row is added to the Raw Data Sheet (e.g Grp 1, Name 76) it should be reflected on the other worksheet.
I'm not an Excel Pro (macros, vba etc...) - any help will be appreciated!
Thanks
Have you thought about just making a Pivot Table?
Create a pivot table with Row Labels Column A and Column B, and Values with whatever fields you want to aggregate. It won't update automatically but you just have to hit the "Refresh" button in the PivotTable Options ribbon to update the data.