Get pivot data & vlookup with multiple criteria - excel

I have the following pivot table:
ID
Name
Ranking
123
Red
1
123
Black
2
123
White
3
124
Black
1
124
White
2
124
Red
3
Considering two conditions: ID&ranking I would like to look into the pivot table and retrieve the name. For example, for ID 123 & Ranking 2 I would like to see the name Black as result.
Any hint to write the formula in excel?

You can use a standard FILTER function and multiply the two criteria to get your filter list
=FILTER(B1:B7,(A1:A7=123)*(C1:C7=2))

Related

Excel Pivot Table: Different Subtotals for Different Value Fields

I have an excel pivot table with two summed field values. I need to subtotal the first one using sum and the second one using average. Here is the desired output:
Region
State
SumOfSales
SumOfUnitsSold
A
NY
100
5
A
NJ
200
3
A Subtotal
300
4
B
FL
250
4
B
GA
300
2
B Subtotal
550
3
So far the closest thing I've been able to find is a custom subtotal through the field settings for Region. But this adds two rows for subtotals. Any ideas?

Counting multiple values in a range to group by category and making a pivot table with slicer

I've been Googling at this for days and I can't seem to wrap my head around it and am not familiar enough to figure it out. I have a table of data. I have a list of categories with multiple codes for each category. Each row in my table has 100 columns than can have category codes in them. They can be blank or have different codes from the same category but no duplicate codes. Here is a small example
val1
val2
val3
val4
val5
val6
user1
3
5
3
6
4
7
user2
6
5
8
2
4
5
user3
7
7
5
3
7
0
user4
1
4
7
3
9
2
I am trying to make a pivot table to count the number of times codes are present for each category. Initially, I created additional columns in the data table, one for each category, that used COUNTIFs to look in all the columns per row and add up the categories. The additional columns look like this:
cat1
cat
cat3
user1
3
5
3
user2
6
5
8
user3
7
7
5
user4
1
4
7
So for example, if you count up all the codes belonging to cat1 for user1 (columns val1 - val100) it would be 3. The problem with this is when making my pivot table the columns are labeled "sum of" followed by category name, but more importantly, I can't make a slicer by category. I can make a slicer for one category and it lets me filter by the number of times the values appears in a row (0,1,2,3, etc).
I made another table with the codes in one column (unique) and the categories in another (not unique), but I just can't figure out how to get my pivot table working. I've been reading about adding a measure and using a DAX formula but I don't know if that's the right approach and I'm not familiar with them either. I need a pivot table because I eventually will turn it into a graph with slicers. Can anyone point me in the right direction?
Seems like your only Option is to Do the CountIF at the end of the table
or Reconstruct your source Table
Like
and then you pivot that like this
Lastly you can pivot that base on your second table
Your second Option is to

How can I merge rows in Excel 2010?

My Excel sheet contains columns for id, date, amount and name.
If two or more rows have the same id and name I want to merge them into one row with the amount of those two combined. Can anybody help me doing this?
Use concatenation with Columns ID and NAME (=ID&NAME) in another column and look for the pivot table. Move to Insert->Pivot table option to get the attached answer]
Hope this clarifies
Here is a possible solution (as far as I understand the problem) using a PivotTable:
As you can see, there is not really much to it. Just insert a pivot table and drag the ID & Name to the Rows while you move the dates and the values to the Values section of the pivot table. The Values in the Column section will be automatically generated.
The only thing I changed at the end was to format the pivot table nicely doing the following:
Remove SubTotals by name
Using a PivotTable style that I like from the PivotTable menu in the section Design.
Show items in a tabular format. That means that the name and the ID are shown on one row and not in a cascading format (ID in one row and the name in a second row underneath + indented). You can achieve this by right-clicking on the name and selecting Field Settings. A new window opens (showing the settings). Go here to the Layout & Print tab and select Show item labels in a tabular form. You might have to repeat that for the field Name and the field ID (depending on which of the two fields you chose to show first in the Rows section of the PivotTable).
Let me know if this solved your problem or if you have any questions.
Note: since no sample data has been provided I made some up. I sure hope this data is somewhat similar to what you are trying to aggregate.
Used sample data:
ID Date Amount Name
1 05.03.2015 121 Peter
2 14.01.2015 127 Max
3 11.01.2015 77 Eva
4 06.11.2015 141 Jamie
5 04.03.2015 58 Sophie
1 04.04.2015 94 Peter
7 20.06.2015 52 Lucas
3 14.12.2015 136 Eva
2 02.11.2015 93 Max
10 20.08.2015 59 Mason
4 11.01.2015 145 Jamie
4 02.02.2015 113 Jamie
4 26.02.2016 89 Jamie
1 30.03.2016 137 Peter
15 09.09.2015 81 Jackson
16 25.02.2015 61 Liam
2 26.02.2016 133 Max
2 26.10.2015 80 Max
19 25.09.2015 76 Aiden

Multiple criteria lookup in categorical data

I've got some raw data like the one shown below and I want to search the value under, Category B, sub-category 3. This is something like a pivot table in compact display form.
I cannot simply use MATCH function since the name of the category is not displayed on each row. I reckon I could probably use an extra lookup column and add some mappings but that seems rather fiddly.
Category Sub-Category Value
A 1 431
2 543
3 13421
4 754
5 43
B 1 456
2 35
3 906
C 1 562
2 13
3 1243
4 765
5 35
6 12
You need to use INDEX/MATCH function pairs to reshape the ranges searched through with the lookups.
        
The standard formula in G2 is,
=INDEX(INDEX(C$2:C$999, MATCH(E2, A$2:A$999, 0)):C$999, MATCH(F2, INDEX(B$2:B$999, MATCH(E2, A$2:A$999, 0)):B$999, 0))
Fill down as necessary.

Excel: filter table rows by specified column value

I have a table with first column as primary key. Ex:
id value1 value2
1 10 5
2 2 3
3 12 5
..
I also have a second list of id's I want to select, which can have repeated ids. Ex:
selectId
1
2
2
2
5
10
..
How can I "merge" the two tables (something like INNER JOIN) to obtain:
id value1 value2
1 10 5
2 2 3
2 2 3
2 2 3
5 99 99
10 22 22
..
I tried using 'Microsoft Query' from Data > Extern Data to join the two tables. The problem is that it seems it cannot handle tables with more than 256 columns.
Thanks
UPDATE:
Thanks, VLOOKUP works as intended.
However one problem is that if the row was found but that corresponding column was blank, this function returns 0 (where I expected it to return an empty cell), and since zero is a valid value, I have no way to differentiate between the two (blank and zero)?
Any help is appreciated..
If this is Excel -like the title says- just use vlookups.
Not very relational, but that's the Excel way.
Using the VLOOKUP function would get you the data in the layout you require.
If you are using Tables in Excel 2007, the formula would look like this based on the example below.
in cell B8
=VLOOKUP([selectId],Table1,2,FALSE)
in cell C8
=VLOOKUP([selectId],Table1,3,FALSE)
Lookup screenshot http://img208.imageshack.us/img208/1/lookupz.png
It is not clear where you store your data, but it looks like you have this problem, described on Microsoft site:
http://support.microsoft.com/kb/272729

Resources