Excel Pivottable Subtract Two Columns - excel

I am trying to figure out how to find net growth in a workforce in a pivotable. As of right now, I have a column that says status and consist of "Hire" and "Separation". I have these both in the pivotable as count of. For example, it could say 6 hire and 2 separation. However, when I do subtotal to see the net growth, it shows these two values added not subtracted. I need it to do subtotal of "hire" count - "separation" count.
Does anyone know how to do this? I know that inserting a calculated field will not work as you cannot calculate a field based of the value of another column

You can accomplish this a little differently, by not using subtotals. Instead, drag Status to your value field twice. The first will show you the number of hires and fires. Then, click the second Count > Value Field Settings > Show Values As. Choose Difference From in the dropdown. Base field is status and Base item is previous.
This will add a second column showing the Net Growth (or loss) of each grouping.

Related

Top 3 Values for Multiple Categories based on hours in a week

I'm working on a charging matrix where project managers can input time to the top three contracts in each category based on a week to week basis. Right now I have a pivot table with the categories (Production, Spares, Development) with multiple contracts that were charged that week. I manually select the top three from each category and copy into a table where I have formulas creating charge numbers for the project managers to use.
The question is, is there a way I can automate selecting the top 3 contracts from each category based on number of hours for that specific week?
Pivot Table & Charging Matrix
You can use LARGE() to get the top 3 (large(data,1) etc)
Then use index() and match() to get the contract names.
I have made a simple example here, but it will not deal with duplicate results in the hours if they are in the top 3...
There are solutions to that already posted.
If I understand you correctly, you want to automate the process of finding the top 3 contracts under each category and then create the charge number based on the results.
You can do so by creating a new pivot table as demonstrated below, put the Category Name and Contract Name in the Rows field, and put the Hours in the Values field, then right click anywhere within the Row Labels column of the pivot table, go to Filter -> Top 10... -> enter 3 in the second field, then you should have the top three contracts for each category.
P.s. You can choose to sort the hours from largest to smallest, and choose NOT to show the subtotals for each category.
Once you have the list, you can enter your formula (I presume you used a formula) in corresponding cells in column H (as in my example) to create the desired charge number.

Spotfire: calculating difference between two rows in same column based on attributes in different columns

I am new to Spotfire and need help in getting the right expression for a calculated column.
My Data contains different subjects grouped in column ID. For every ID, Bodyweight was measured on different days. Days are given in column Day and stated as 1,2,3...
The last day is denoted by Last and Bodyweight measurements given in another column. Another column is present which is called Baseline. The Body weight measured is considered as baseline if the column contains a Y for that row.
I need to insert a calculated column, which will contain the difference between Body measurement measured on Day denoted Last and Body measurement marked by Y in column Baseline.
This should be done for every new ID. I am not able to figure this out. Could someone advise me on how to go about it?
Here is an example attached
So, the calculated column for Rita will give -4 (body weight at Last=56 and BodyWeight at baseline=56, so 52-56 =-4)
the sample data you provided is a little weird, particularly the [Day] column. if it's within your control, I suggest to use actual dates rather than a number/string here.
barring that, I was able to get your desired results, but it required two calculated columns: the first one will consolidate the [Day] and [Baseline] columns into a single column, and the second one contains your desired info.
column 1, which I called Day (int):
CASE
WHEN [Day]="Last" THEN 1000000
WHEN [Baseline]="Y" THEN -1000000
WHEN [Day]!="Last" THEN Integer([Day])
END
I picked a random high and low max to establish a chronological order. this will put 1000000 in place of "Last" (if you have any programs that are longer than one million days, you'll need to increase this number). the same for the [Baseline] column, but that value will be -1000000, which is presumably the lowest value you will ever see in this column. both of these are assumptions and may not work for your implementation. finally, in all other cases, the day number will be used.
column 2, which I called Diff:
Last([Weight]) OVER (Intersect([Name],LastNode([Day (int)]))) -
First([Weight]) OVER (Intersect([Name],FirstNode([Day (int)])))
the first line uses what's called an OVER expression to retrieve the first value for [Weight], ordered by [Day (int)], per [Name]. the second line gives the reverse of that, and so the difference is calculated as -4 (or whatever is appropriate).

Use particular formula based on referenced value

I am working on creating a price list that uses calculated values to determine the price based on cost of good sold, area, and a few other things for some items.
There are different formulas used depending on the item type.
For example, prints would be calculated with an AREA multiplier type using the equation [#Multiplier]*[#Area] (referencing formatted table values, but they could also be typical references (f2*g2 for example)
So my question is, how could I set it so that a lookup of the multiplier type will reference a table that has the formula needed for that calculation.
I figured something like vlookup, but that either displays the equation itself, not the result, or doesnt work at all.
Currently, I have a big IF statement that works, but is a pain if I want to change the formula.
=MROUND(IF([#Mtype]='Multipliers 2'!$V$4,'Multipliers2'!W4,IF([#Mtype]='Multipliers 2'!$V$3,[#Multiplier]*[#Area]+40,IF([#Mtype]='Multipliers 2'!$V$5,2*[#[Cost of Goods]]+[#Multiplier], IF([#Mtype]='Multipliers 2'!$V$6,[#Area]*[#[Cost of Goods]]*[#Multiplier],[#Multiplier])))),0.5)
To Clarify, each product will have a multiplier type, along with data associated with the product that will be used for calculations:
So if I mark a product to use calculation A, the program should go look in a formula table, figure out what Calculation A is and then use those values to determine the result. If Calculation A = (Multiplier + 2*cost of goods sold), then it will look up the value in the multiplier column and add it to 2 x COGS.
Calculation B may be Multiplier * COGS and so on.
A problem I had last time I tried this a while ago was that even if I were to get the value to return some sort of result, I couldn't get the reference to change properly to correspond to the required row.
The data above is a small sample of what I'd be doing. Each product is part of a product type which has multiple variations in size, etc. So each product would reference a multiplier table which is used to calculate the final price, so if I want to change the prices for the entire group, all I'd have to do is change the value in the multiplier table, or the equation, and every corresponding product adjust accordingly.
The mtype would be controlled by the multiplier table. So I would like to set it so that if a particular mtype is used, the final calculation in the Price column will be determined by the formula listed.

Calculate % of filtered values from all values in Excel Pivot Table

I have this pivot table that currently shows how many students failed in a particular subject in a particular academic year. That is, it is now filtered by Pass_Status Fail(which can be either Pass or Fail):
For example, in Business Computing subject there were 3 people in 2002-2003, and two of them failed. That is what the table shows right now.
But I want to convert it into percentage, considering the number of all the students who took the subject in an academic year as total.
In the case of Business Computing in 2002-2003, I want to show 66% (2 failed of 3).
How can I do that?
Unless I'm missing something, don't you just right-click on any value (use the 2 for the example), go to submenu "Show Values As", and choose % of Row Total??
I solved the problem by creating a new calculated field with this formula:
percent_of_fails:=CALCULATE(COUNT(ModuleRegistration[ID]), FILTER(ModuleRegistration, ModuleRegistration[Pass_Status] = "Fail")) / COUNT(ModuleRegistration[ID])

Picking top 5 scores from a range

I run a small golf eclectic with excel. One of the things we have is a points system. I would like to get the 5 highest points scored over the season and have them ranked from 1 (being the highest points scored) to 5.
My knowledge of excel "sums" goes only a wee bit further than add and subtract.
Thanks!
If you don't want to change the order that they are presently in you can use the LARGE function. It returns the kth largest value.
Below is a great formula, if you drag it down it will automatically get the second, third and nth largest value from a table of data (in this example the data is between A1 to A10).
=LARGE(A1:A10,ROW(A1)-ROW($A$1)+1)
You can then match the values with names or corresponding data from the tables using the MATCH and INDEX functions. The example below would fetch the name for each value from the second column.
=INDEX($A$1:$B$10,MATCH(cell reference with score or value,$A$1:$B$10,2))
Play around with these formulas, they are very convenient for data m
If you have a column containing the scores, you could add a filter (Data->Filter I think) and sort descending.
Though, if you just have rows that are something like [Date][Person][Score] you'll need to go to another sheet and SUM the scores for each person then sort that... Unfortunately my Excel skills aren't up to par to pull a score for each person like that.
Given a list of numbers in A1 to A10, you can work out their 'Rank' relative to each other by using 'RANK'.
e.g.
RANK(A1,A1:A6,0)
RANK(cell, list of cells to check against, order)
For order, 0 = descending.
From there you can work out which one is first pragmatically.
If you have Excel 2007,
Check that your data is continuous, with no blank rows or columns. Click on your scores and then select 'Data - Filter'
Using the dropdown that the filter creates at the top of your scores column and select 'Number filters - Top ten'
A 'Top ten Autofilter' dialog will be displayed, reduce the show 10 to 5 and then click on OK.
For earlier versions of Excel add a RANK formula in a new column. Be careful as the scores need to be sorted, usually into descending order. If there are any ties, they will be given the same ranking number and the subsequent rank number will be incremented by the number of ties. (E.g. If there are two scores of 2, ranked as 5. The next score will be ranked as 7, not 6)
If you want to use the LARGE Function as described above, make sure you put the same range in the list for each of the LARGE functions. That is, change =LARGE(A1:A10,ROW(A1)-ROW($A$1)+1) to =LARGE(A$1:A$10,ROW(A1)-ROW($A$1)+1) or you will get some strange incorrect results

Resources