Exclude Rows with 0-values from PivotTable without Helper Column - excel

I have the following Excel spreadsheet:
A B C
Quantity Sales Price
1 Product A 500 0
2 Product A 0 5.95
3 Product A 600 19.95
4 Product B 250 0
5 Product B 0 44.99
6 Product C 700 29.99
In Column A you can see different products that can appear several times in the list. In Column B and Column C you can see their quantity and sales price. There can also be cells with value 0.
Now I created a simply PivotTable based on this data which gives me the following result:
Count of Quantity
Product A 3
Product B 2
Product C 1
As you can see the rows that contain 0 values are also in the count.
Since I want to exclude them I inserted a "Helper Column" in the original data with the following formula:
=IF(OR(B2=0,C2=0),"=0","<>0")
This "Helper Column" I use as a Report Filter in the PivotTable.
Well, that solution works so far but is there also a way to avoid the "Helper Column" and do the "Exclude 0-Function" directly in the PivotTable?

Yes.
Add Quantity and Sales Price to your Pivot Report Filter Panel.
In the filter, choose all and then remove 0 from both.
Right-Click each filter and choose Field Settings, and tick "Include New Items in Manual Filter".

Related

Get record from another sheet when value selected from dropdown

I am using Excel 2007
I have two sheets. 1) Orders And 2) Products
Orders :
A B C D E
Sr No particulars quantity rate amount
-----------------------------------------------------------------
1 Dropdown from
Products B2:B50
------------------------------------------------------------------
2 Dropdown from
Products B2:B50
------------------------------------------------------------------
....... And So On.....
Products :
A B C
---------------------------------------------
Sr No ProductName Rate
---------------------------------------------
1 ABC 440
2 DEF 210
3 XYZ 185
...... And SO On...
In Orders Sheet, In Particulars, Dropdown box is generated with productnames in Products Sheet with Data Validation.
I want to autofill Rate of Product Selected from dropdown in Orders sheet
I tried VLOOKUP... But without success
I guess that in your "Product" sheet it will not be duplicated a Vlookup works.
For instance ABC remains 440 as rate? Then you can have your "quantity" x "rate" to get your amount. What have your tried in Vlookup and what error?
Try this in Orders sheet cell D2
=VLOOKUP($B$2,Product!$B:$C,2,FALSE)

Sort list by the difference between two values

I have the following Excel spreadsheet:
A B C D
1 Budget Actual Sort by Variancy (descending)
2 Product A 500 250 Product F
3 Product B 900 800 Product D
4 Product C 300 450 Product C
5 Product D 400 600 Product B
6 Product E 700 300 Product A
7 Product F 150 900 Product E
As you can see in Column A I have listed different products and in Column B I have their budget value and in Column C the actual value.
Now, I want to list those products based on their budget-actual-variancy in Column D in a descending order (starting from the highest positive variancy).
The only formula which comes in my mind is =LARGE(B2:B7,1) but it only sorts the products by the budget values (Column B) or actual values (Column C). Not by the difference between the two values.
Do you know any formula which I can use to sort the products in Column D based on their variancy?
Please note:
I know I could add a helper column in which I calculate the differences between Column B and Column C and then go with the LARGE function on this helper column but I am looking for a solution without such a helper column.
If one has SORTBY()(Currently only available with Office 365 insiders) then put this in D2 and it will spill automatically:
=SORTBY(A2:A7,B2:B7-C2:C7,1)
You can use the following (even when there are duplicate variances):
Formula in D2:
=INDEX($A$1:$A$7,LARGE(INDEX(($C$2:$C$7-$B$2:$B$7=AGGREGATE(14,3,$C$2:$C$7-$B$2:$B$7,ROW(1:1)))*($A$2:$A$7<>D1)*ROW($A$2:$A$7),),1))
Drag down.
In case of duplicate variances it will grab the last value in column A that represents that variancy and has not been featured in column D as yet.

VLOOKUP when criteria exists mutliple times in matrix

I have the following Excel spreadsheet:
A B C D
1 Product A 500 Product A 500
2 Product B 800 Product A 700
3 Product C 450 Product A 300
4 Product A 700 Product B 800
5 Product A 300 Product B 400
6 Product C 300 Product B 250
7 Product B 400 Product C 450
8 Product B 250 Product C 300
In Column A and Column B the sales of differnt products are listed. A product can appear several times in Column A because each sale of the product is displayed.
In Column C the different products are sorted from A-C.
In Column D I want to use a VLOOKUP to get the sales from Column B for each of the products.
=VLOOKUP(C1,$A$1:$B$8,2)
However, since the products appear several times in Column A the VLOOKUP gives me only back one of the values.
How do I have to change the VLOOKUP to get each sale of the same product?
You cannot get desired result single VLOOKUP formula.
Use this array formula:
=INDEX($B$1:$B$8,SMALL(IF($A$1:$A$8=C1,ROW($A$1:$A$8)-ROW(INDEX($A$1:$A$8,1,1))+1),COUNTIF($C$1:C1,C1)))
Paste it into D1 and press CTRL+SHIFT+ENTER to change it into array formula, then pull formula down.
Another approach:
Insert one empty row above the data, then put this formula in column D (you can hide this column if you want to):
=MATCH(D2;INDIRECT("$A"& 2 + IF(D2=D1;E1;0) & ":$A$9");0)+IF(D2=D1;E1;0)
And this formula in column E:
=INDEX($B$2:$B$9;E2)
MATCH works similar to VLOOKUP but instead of the actual value returns the index of the result. INDIRECT("$A"& 2 + IF(D2=D1;E1;0) & ":$A$9") alters the searchmatrix based on the previous index of the search value (e.g. the first "Product A" is found at index 1 therefore the second "Product A" only looks in A3:A9, the second "Product A" is at index 4 thus the third "Product A" looks in A6:A9).
The second formula just extracts the value based on the matrix in column B and the index in column D.

excel pivot table - count appearance of certan value in column

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.

Extract Data from a Table in Excel Based On A Criteria

I have a list of data in 'Table1' on an Excel spreadsheet that looks like this:
Column A Column B
Pizza Sauce 3
Pepperoni 0
Cheese 1
Crust 2
Garlic 0
Sausage 0
From this list I want to be able to create a second list that, based on the value in B, shows the value in A. I want anything that is greater than 0 to show in this list (For an order sheet to give to a vendor). Like such:
Column A Column B
Pizza Sauce 3
Cheese 1
Crust 2
How might I go about doing this? I've looked around but haven't been able to do so successfully.
Why don't you use pivot table and filter out 0 value in column B. So every time you want an updated table, you just have to refresh the pivot table and your table is ready.
You can find pivot option in Insert -> PivotTable and provide the source data.

Resources