How to Summarise Positive / Negative Number without Adding New Column in Excel Pivot Table - excel

Raw data is following format:
Name Team Talent
---------------------------
Quill Red 500
Drax Red -900
Ego Blue 2,000
Kraglin Red -200
Rocket Red 900
How can we make a pivot table like below without adding new column to original data:
Team Sum_Pos_Talent Sum_Neg_Talent
-----------------------------------------
Red 1,400 -1,100
Blue 2,000 0
Tried adding calculated fields, but the calculation is on the number on pivot table, not on each row of data.

You can use SUMIFS.
Sum_Pos_Talent
=SUMIFS($C$2:$C$6,$B$2:$B$6,E2,$C$2:$C$6,">0")
Where C2:C6 is the Talent column, B2:B6 is the Team Column, E2 is the name of the team in the other table.
Similarly Sum_Neg_Talent
=SUMIFS($C$2:$C$6,$B$2:$B$6,E2,$C$2:$C$6,"<0")

Sort the data to separate positives from negatives and insert a new row of headers between the two sets (say rename Talent to Sum_Pos_Talent and for inserted header switch to Sum_Neg_Talent). Then, assuming Team is in B1 (and in B5) create the PT from multiple consolidation ranges (B1:C4 and B5:C7) eg as here.

Related

Excel VBA macro create new value from 2 entire column

I need to sort values from an entire column.
I do have one column city which have different values of 0 or 1 ( 0% and 100% )
There are 90 000 rows.
I'll need to do a percentage by compiling the values of 0 and 1 by doing the average
I want that value to appear in the column I
Like what I want is that:
You can use AVERAGEIF combined with IF
Function
AVERAGEIF
My fake data:
My formula at C2 (and drag down)
=IF(A2=A1;"";AVERAGEIF($A$2:$A$13;A2;$B$2:$B$13))
Anyways, I would suggest to use indeed Pivot Tables:
Create a PivotTable to analyze worksheet
data
With Pivot Tables, you could group your data using cities field, and then calculate the average easily, and just 1 single row per city instead of those empty rows

Fill in table based a column of categories in Excel

I have a table that looks like this:
Type Value
Movie 5
Food 3
Gas 10
Food 2
.... ....
And There's a second table I want to fill in with "Value" based on their type in the first table, so that the corresponding rows look like this:
Rent Food Movie Gas Clothing ... ( appear in specific order bc they are subcategories)
5
3
10
2
The title row is already there, so I was thinking there might be some kind of lookup method to do this? How do I do that?
your second table apperas to hold one value per row but it doesn't have a label. it does correlate to the original row number, is this by design or coincidence?
if this is by design then you can use those 2 columns, hide them if you like, get a unique list of categories by copying you r abels to a new colum, removing duplicates in the data tab, then paste special transpose in c1 to create colum headers.
so column a and b remain unchanged
row 1 contains header starting at column c
your data starts at c2
this is the formula
=Iferror(vlookup(C$1,$A2:$B2,2,false),"")
drag it down and to the right
you can copy paste special values when done to remove the formulas
for something with only a hundred or thousand cells this will be one of the easier options but i would not do this on large tables, for those i would use power query or VBA
Assuming your 1st table is in Sheet1 and 2nd table is in sheet2.. you may try to fill in Sheet2!A2
=IF(Sheet1!$A2=A$1,Sheet1!$B2,"")
and drag it all the way.. Hope you get how it works.. and what you need.

Sumproduct using 2 criterias and on filtered values

I have the following source table
Date | fruit | veg
The user has previously filtered the date by month. In another table, I want to count the number of apples and tomatoes for example. To remove the invisible rows I use the SUBTOTAL function as
=(SUBTOTAL(102;OFFSET(limiter;ROW(limiter)-MIN(ROW(limiter));;1;1)))
where 'limiter' is the date range.
Then to count the number of apples in the fruit column , I use
= SUMPRODUCT(SUBTOTAL(102;OFFSET(limiter;ROW(limiter)-MIN(ROW(limiter));;1;1)) * Table!fruit = "apple"
and it works fine.
But, if I want to add in the vegetables criteria along with the fruit, the result is 0. I tried doing the sumproduct of fruit and veg first and then add the subtotal function but it gave a huge number.
Have you considered using a pivot table? (I strongly recommend you to)
Go to a new tab, select A1 and insert, new pivot table. You can put the fruit field in the column (probably row labels - my excel is in Portuguese =/). You would instantly have a table containing as first colum the list of existing fruits.
Then add the date to the body (probably values) of the pivot table and certify the type of value shown is count.
You would intantly get the count of all fruits.
The great advantage is that you can play around with this table as easily as dragging and dropping fields in columns, rows and body/values and instantly getting the results you want without having to figure out any formula issues.
Pivot tables also allow you to filter not only the date, but any other fields you wish.

Merge multiple values in one column into same cell

EDIT: The intended output is to have one spreadsheet of the untouched IDs and commodity categories, and one spreadsheet with 1 occurrence of ID with the commodity categories combined. This is because I'm writing reports on total number of commodities and total number of unqiue incidents.
I have a spreadsheet that has an ID number across multiple rows with a commodity category and what I need to do is get the commodity categories associated with that ID number into the same cell. I'm seeing a lot of stuff about INDEX/MATCH but I'm not sure how it applied to my specific example.
Most examples are outputting data from the same column into the same row/multiple columns or something slightly different. I need to do this row about 600 rows and all have varying amount of rows and values. Some IDs have only one value, some have 40 values, and some have 2. Appreciate the help.
The intended input/output is below.
EX:
ID Commodity Category
A01-0301 Food and Beverage
A01-0301 Apparel and Accessories
A01-0301 Food and Beverage
A01-0302 Other
ID Commodity Category
A01-0301 Food and Beverage, Apparel and Accessories, Food and Beverage
A01-0302 Other
'Dirty' but might be adequate, assuming ID is in A1:
Sort by ID, copy last populated cell in ColumnA down one cell. In C2:
=IF(A1=A2,C1&","&B2,B2)
in D2:
=A2=A3
Select all, Copy, Paste Special, Values over the top, filter ColumnD to select TRUE and delete visible, adjust bottom entry.

Excel - trying to identify top 3 sales numbers in column d, and return information from corresponding column a

Excel - trying to identify top 3 sales numbers in column D (D5:D:41), and return information from corresponding column A (A5:A41)
You can get the top 3 with
=INDEX($A$5:$A$41,MATCH(LARGE($D$5:$D$41,ROW(A1)),$D$5:$D$41,0))
Copy down two rows.
You could use a pivot table to very easily get his information.
Select insert a pivot table
Select your data
In the pivot table window place the 'Name' field into the 'Row Labels' box and the 'Sales' field into the 'Values' box.
This should give you a pivot table with a list of people and the sum of their sales, making it very easy to see who comes out top.

Resources