how to choose and sum data from excel table automatically - excel

I'm setting up an excel data table that i need to make a monthly statistics from it. how can i automatically choose a characteritic from the table and get all its values sumed up ?
This is a garage based data, that includes daily entries and the productivity of every technicien on a daily basis. What i'm asking for is, can i find a way to sort all 5 techniciens in a different table and get their productivity summed up automatically ?
here is the data table and an example for what i am trying to do.
n Date CLIENT Date d'entrée MO Techniciens HT€ Prestation
1 01/03/2019 YAYA 01/03/2019 30 900 FLORENT 30 900 Passage au banc
2 05/03/2019 DAVID 05/03/2019 30 000 LOBA 30 900 Passage au banc
3 07/03/2019 NAME 20/02/2019 60 000 YAPO 60 000 Ctrle injecteurs
4 08/03/2019 MATFORCE 01/03/2019 39 000 LOBA 42 151 Passage au banc
what i want is to have another table with the techniciens name in it and the sum of HT€
technicien heures factures/mois
PRINCE 10 000
MOUSSA
ETIBOIS

Select Data
Insert -> Pivot Table
Set Technicians as Rows and Sum of HT as Values
Source data was slightly altered to better illustrate the answer

Like #Marc in the comment to the question, I would suggest SUMIF(), SUMIFS() or Pivot Tables.
Pivot Tables are the easiest as they can SUM by multiple criteria without a lot of programming. But they only do one thing at a time so SUM and AVERAGE need to be done separately.
SUMIF(range,criteria, sumrange) will return the sum of all of the cells in sumrange that are in the same row where the value in the range meets the criteria for example:
=SUMIF(A1:A999,="Charlie",B1:B999)
Where A1:A999 has the technicians' names, B1:B999 has their billing amounts
SUMIFS() is similar but allows multiple selection criteria.

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?

Use a Count field as a row in Excel Pivot table

Not sure if it is possible but I'd like to have a pivot table that summarizes how many occasions properties have been missed, and then shows the number of times properties have been missed that many times.
What I'm looking to end up with is something like the below:
TIMES MISSED PROPERTIES MISSED THAT AMOUNT OF TIMES
1 102
2 76
3 23
4 11
5 2
Information is currently in the following format:
UPRN DATE MISSED
1029292 1/1/2020
1029292 5/6/2020
1010101 1/2/2020
1046353 4/3/2020
3894387 8/2/2020
3894387 7/2/2020
3894387 9/2/2020
So this would give the following table:
TIMES MISSED PROPERTIES MISSED THAT AMOUNT OF TIMES
1 2
2 1
3 1
Is this possible? And if so, how?
Pivot tables in Excel can summarize data not only with SUM function, but also with COUNT and other functions.
Right-click a field in the "Sum values" field chooser and then select Value Field Settings... From there you can choose the function to summarize your data (COUNT in your case).

Excel: how to NOT sum based on text values?

I am trying to sum values based on another text column.
Let's say my data look like this:
date item amount
4/3/03 book 100
8/3/05 rent 1090
5/6/06 food 5
2/7/09 repair 390
8/3/10 rent 1090
so I want to sum all the spendings (amount) when the "item" section is NOT equal to "rent", but I dont just want a grand sum, I just want a sum that's up to that date.
So the desired output (last column, subtotal) should look something like this:
date item amount subtotal
4/3/03 book 100 100
8/3/05 rent 1090 100
5/6/06 food 5 105
2/7/09 repair 390 495
8/3/10 rent 1090 495
I've tried to sum it up while filtering the rolls to only show anything but rent, but when I clear the filter, all the numbers will sum INCLUDING rent.
I've also tried using SUMIF (I named the top cell in "Amount" column as "first_amount"):
=SUMIF(C2,"rent",first_amount:E2)
But I dont think I'm using it correctly or maybe it just doesn't work. It shows no value whatsoever.
I found this post and read through the function pages, but still am not being able to do what I wanted to do:
Excel summing values based on multiple conditions
BONUS:
What if I want to exclude both "rent" and "food"?
I'm sure there's a very simple solution out there that I am just too dumb to think of. Any hint/help is truly appreciated!
Assuming A1 is the first cell make D1:
=SUMIF($B$2:B2, "<>rent", $C$2:C2)

Lookup and replace specific values with reference in pivot table

If I'm trying to find specific names in a list given from my pivot table such as -
Row Labels Revenues Order #
Panera 25 0
Pasta 15
Salad 10
Olive Garden 40 0
Sandwich 20
Pasta 20
Panda Express 30 0
Rice 15
Chicken 15
And I want to search through my document, find Olive Garden and Panda Express and I wanted to replace the 0 in the order # column with 10 for Olive Garden and 20 for Panda Express. Currently, someone here helped me out with
=IF(IFERROR(VLOOKUP(A9,worksheet!K:K,1,FALSE),"")="","",0)
which inserts 0's for the headers and blanks for the orders in the 'Order #' column, can I add a second formula that would find the names and replace the value in that column? Or adjust the current formula?
Quick note - order # column is not from the pivot table.
To make it more clear, - I am getting data from an external source (i.e. paper invoices), as opposed to making a manual entry to adjust the 0's in the order # column, I would like to tell VBA/Excel - "hey Olive Garden's order number is 10 and Panda Express's order number changed to 20, adjust".
this is my end goal -
Row Labels Revenues Order #
Panera 25 0
Pasta 15
Salad 10
Olive Garden 40 10
Sandwich 20
Pasta 20
Panda Express 30 20
Rice 15
Chicken 15
If you have a range with the restaurant names in one column and the order numbers in the next column (say columns X and Y of the sheet called "worksheet"), you could change your formula to be
=IF(IFERROR(MATCH(A9,worksheet!K:K,0),"")="","",IFERROR(VLOO‌​KUP(A9,worksheet!X:Y‌​,2,FALSE),0))
(P.S. Changed the original VLOOKUP to MATCH based on useful feedback from teylyn.)
FWIW, that formula would be better using MATCH, not VLookup, since it's returning the value from the first column.
But back on track: what are you trying to achieve? Change the values in a pivot table?
First, a formula cannot change values in another cell.
Second, a pivot table reports on existing data. You can't change the numbers that a pivot table reports.
You will need to re-think your approach. If you don't like the numbers the pivot table returns, you'll need to change the underlying source data.

Sum of Averages in Excel Pivot Table

I am measuring room utilization (time used/time available) from a data dump. Each row contains the available time for the day and the time used for a particular case.
The image is a simplified version of the data.
If you read the yellow and green highlights (Room 1):
In room 1, there are 200 available minutes on 1/1/2016.
Case 1 took 60 minutes, case 2 took 50 minutes.
There are 500 available minutes on 1/2/2016, and only one case occurred that day, using 350 minutes.
Room 1 utilization = (60 + 50 + 350)/(200 + 500)
The problem with summing the available time is that it double counts the 200 minutes for 1/1/2016, giving: Utilization = (60+50+350)/(200+200+500)
There are hundreds of rows in this data (and there will be multiple data dumps of differing #'s of rows) with multiple cases occurring each day.
I am trying to use a pivot table, but I cannot obtain the 'sum of averages' for a particular room (see image). I am using a macro to pull the numbers out of the grand total column.
Is this possible? Do you see another way to obtain utilization?
(note: there are lots of other columns in the data, like case start, case end, day of week, etc, that are not used in this calculation but are available)
The reason that you're getting 300 for both Average of Available Time columns is because the grand total is a grand total based on the overall average and not a sum of the averages.
Room 1: 200 + 200 + 500 / 3 = 300
Room 2: 300 + 300 + 300 / 3 = 300
I could not comment on the original question, so my solution is based on a few assumptions.
Assumption #1: The data will always be grouped. E.G. All cases in room 1 on a given day will grouped in sequential rows.
Assumption #2: The available time column is a single value for the whole day, there will never be differing available times on the same day.
Solution: Use column E as the Actual Available Time. This column will use a formula to determine if the current row has a unique combination (Date + Room + Available Time) to the previous and if so, the cell will contain that row's available time.
Formula to use in E2:
=IF(AND($A1 = $A2, $B1 = $B2, $C1 = $C2), 0, $C2)
Extend the formula as far down as necessary and then include the new column in your PivotTable data range.
End Result
I created a unique reference by combining columns and then used sumif/countif/countif.
So the formula in column E would be:
=sumif(colB,cellB,ColC)/Countif(colB,cellE)/Countif(colB,cellE)
Doesn't matter if the data is in order or not then.
Extend the formula as far down as necessary and then include the new column in your PivotTable data range.
The easiest method I would recommend is this.
=SUM(H:H)-GETPIVOTDATA("Average of Available Time",$G$3)
The first term sums the H column, and the second term subtracts the grand total value. It is a dynamic solution, and will change to fit the size of the pivot table.
My assumptions are that the Pivot Table was originally placed in cell G3.

Resources