Excel report from Pivot table - Issue - excel

I have to create a report in excel.I have to use a pivot table as datasource.
For example my pivot table is like below.
Year column is dynamic(count may decrease or increase)
Year Category Value
-----------------------------
2009 A 58
2012 A 10
2014 B 9
2013 C 7
2014 C 12
2012 C 54
2013 B 8
In my excel report I have to show like below.
Year A B C
--------------------------
2009 58 0 0
2012 10 0 54
2013 0 8 7
2014 0 9 12
--------------------------
Total 68 17 73
Please give me a solution for this.

I did not use pivot table. this is how i would do it. On the sheet with your raw data, do the following first:
The formula for column D is
=A2&B2
and the formula for column E is
=SUMIF(D:D,D2,C:C)
On a new sheet, manually enter the year for column A. Manually enter the headers "A", "B", "C" for the next 3 columns.
The formula I have used for column B is =IF(ISNA(VLOOKUP(A2&$B$1,Sheet1!D:E,2,0)),0,VLOOKUP(A2&$B$1,Sheet1!D:E,2,0))
The formula i used for column C is =IF(ISNA(VLOOKUP(A2&$C$1,Sheet1!E:F,2,0)),0,VLOOKUP(A2&$C$1,Sheet1!E:F,2,0))
and the formula i used for column D is =IF(ISNA(VLOOKUP(A2&$D$1,Sheet1!D:E,2,0)),0,VLOOKUP(A2&$D$1,Sheet1!D:E,2,0))
Hope this helps.
Cheers.

Related

Pivot Table calculated field values are incorrect

I'm trying to create a calculated field in my pivot table and am having issues getting the calculation right.
Consider the following "raw" pivot table:
I tried to create a calculated field that showed the net availability for an application (general formula: (Availability-Downtime)/Availability). In the Calculated Field menu, I did the following:
where the Formula is =(AVERAGE(Availability)-SUM(Downtime))/AVERAGE(Availability). The result is here:
Clearly the uptime for Application A in 2012 should be (1000-35)/1000 = 96.5%, but it's not. Where am I going wrong, here?
Here is my raw data (Availability is the same for each value of Application... these values were merged from another table via VLOOKUP):
ID Application Downtime Year Availability
1 A 15 2012 1000
2 A 20 2012 1000
3 A 12 2013 1000
4 A 0 2012 1000
5 B 12 2012 1200
6 B 14 2012 1200
7 B 23 2012 1200
8 B 90 2013 1200
9 C 23 2012 1100
10 C 32 2013 1100
11 C 34 2013 1100
12 C 12 2013 1100
I believe that it's the aggregation on top that is causing the unexpected result.
For example, where as you are expecting:
(AVERAGE(Availability)-SUM(Downtime))/AVERAGE(Availability)
What effectively is being calculated is:
(SUM(Availability)-SUM(Downtime))/SUM(Availability)
(or average depending how the field in the pivot table is aggregated)
To get the the calculation that you are after you could use a helper column populated with 1's to calculate the average availability, example below:
(Availability/helper-Downtime)/(Availability/helper)
(Then sum this in the pivot table)

Excel Comparing Multiple Columns

I have a spread sheet that has computers in the furthest left column with their specs in columns B - L. There are a lot of extraneous computers in this list I don't need to work on, so I wrote a little Python script to pull out the bad values from the computer list (what was in column A). I then inserted a column to the left of column A (so what was in A is now in B and the good values are in A). I basically need to keep column A as it is, make column B match it and also remove the corresponding specs of the computers I don't need to worry about, but keep everything sorted so I know what specs go with what computer I need to work. Is there any way to do this in Excel?
thanks
Vlookup should do the trick
Assuming the current source data looks like this:
A A 1 2 3 5 6
D B 7 8 9 10 11
F C 12 13 14 15 16
D 17 18 19 20 21
E 22 23 24 25 26
F 27 28 29 30 31
G 32 33 34 35 36
and desired output is this
A 1 2 3 5 6
D 17 18 19 20 21
F 27 28 29 30 31
On a new sheet to keep it clean
Assuming SHeet1 has your current data
in Sheet2 column a Sheet4!A1
in Sheet2 column B VLOOKUP(Sheet4!B1,Sheet4!$B$1:$G$7,2,0)
VLOOKUP(Sheet4!B1,Sheet4!$B$1:$G$7,3,0) for column C and etc
dirty and tedious, but should work.
I think you should try adding data into columnA (new) based on whether the (new) columnB values feature in the good list (elsewhere), say with MATCH. If they do not #N/A should be returned and that might be used to filter on and delete what is visible.
If your 'good' list is in Sheet2 column C you might try:
=MATCH(B1,Sheet2!C:C,0)
copied down to suit.

Identify Rows with Same Values in 2 Different Columns

I have a data set of roughly 405,000 rows and 23 columns. I need the records where the value in column "D" is the same as the value in column "H" for that row.
So for
A B C D E F G H
13 8 21 ok 3 S - of
51 7 22 no 3 A k no
24 3 23 by 3 S * we
24 4 24 we 3 S ! ok
24 9 25 by 3 S # we
75 2 26 ok 3 S 9 ok
etc...
I'd get back the 2nd row, the 6th row, etc...
A B C D E F G H
51 7 22 no 3 A k no
75 2 26 ok 3 S 9 ok
Based on other posts like: Formula to find matching row value based on cells in multiple columns I tried using a Pivot Table, but it complains I can't put either of my two columns in the "Columns" area because there is too much data. With both columns in the "Rows" area, I get a relationship of D to H, but I can't then find a way to filter on only those where D = H.
I've also looked into countifs(), vlookup, and index / match functions, but I can't figure this out. Help please.
I would do a simple "IF()" formula in a new column.
For your example add a new column I and use the following formula in the first data row (I2):
=IF(D2=H2,"Yes","No")
Fill down to the end of the data.
Then using Excel filters or countif you can check the number of "Yes" vs "No" in your data.

Excel using INDEX and multiple MATCH

I am having trouble using INDEX and MATCH functions in excel. Say I have the following data:
A B C D
Year Month Site Count
2004 3 X1 54
2006 6 X3 10
2005 10 X5 15
And I want to arrange it like this
E F G H I J K
Year Month X1 X2 X3 X4 X5
2004 1
2004 2
2004 3 54
2004 4
2004 5
2004 6
...
2005 10 10
...
2006 6 15
I have the following formula (I want to match the Site, Year and Month):
=IFERROR(INDEX($D$2:$D$4,MATCH(G$1,$C$2:$C$4,0),MATCH($E2,$A$2:$A$4,0),MATCH($F2,$B$2:$B$4,0)),"")
and it seems to work fine for the first column (G) but when I autofill the rest of the columns (H:K) it doesn't work. Any ideas? Thanks.
I'd take a different approach than using all these nested matches, and create a searchable column with unique values and MATCH that column to get a row to feed into the INDEX.
Insert 2 rows between Cols D and E, putting the 2nd appearance of 'Year' in Column G. (Because I like some whitespace)
Paste this formula in E2 and copy it to E3:E4
=CONCATENATE(C2,"-",A2,"-",B2)
If it bothers you, hide Column E.
Then paste this formula in I2 and copy it to I2:M4:
=IFERROR(INDEX($D$2:$D$4,MATCH(CONCATENATE(I$1,"-",$G2,"-",$H2),$E$2:$E$4,0),0),"")

select min value in B column for same values in A columns excel?

I would like to get e.g. min or max value from column2 for same value in column1.
In mine example I want max value from column2 for value A (column1) and that is 18, and for B is 27.
I've tried with array function but I cannot manage it to work properly.
Tnx for any tip or solution.
Example:
Column1 Column2 Max_value
A 1 18
A 5 18
A 18 18
A 3 18
A 4 18
B 2 27
B 5 27
B 18 27
B 27 27
B 5 27
B 3 27
Sorry for poor example, but I couldn't post picture, my rank is not high enough :)
The standard "array formula" is like this for C2
=MAX(IF(A$2:A$100=A2,B$2:B$100))
confirmed with CTRL+SHIFT+ENTER and copied down column - adjust ranges as required
replace MAX with MIN to get the minimum values in the next column
This is a cinch with pivot tables. Here's one way to do it.

Resources