Lookup and replace specific values with reference in pivot table - excel

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.

Related

extract values based on two columns

I would like to extract a price value based on two other columns. In table 1, I am given the raw data where I want to draw from. In Table 2, I am given only the contract number, and I would like to find the type being "Mater" and have the price listed out for it.
I've tried to use this formula but I don't think I am calling the columns correctly.
=IF(AND(Table2!A1=Table1!$A$1:$A$6,Table1$C$1:$C$6="Mater"),Table1!$D$2:$D$6,"")
Is there a formula using index match, if(and), or another one that could work in this case?
Thank you!
Table 1.
Contract
Work
Type
Cost
5321a
aaa
Labor
52
5321a
ab
Mater
57
5641a
aba
Mater
10
536451a
aae
Labor
75
2441a
aan
Labor
42
53421
aar
Mater
14
Table 2
Contract
Mater Cost
5321a
57
5641a
57
53421
14
The following should work:
=SUMIFS(Sheet1!D2:D7,Sheet1!A2:A7,A2,Sheet1!C2:C7,"Mater")
(I'm assuming the first table in on Sheet1)

how to choose and sum data from excel table automatically

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.

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)

How to Combine Columns with the Same Heading in Excel

I have a set of cost data for different pieces of unique equipment. Each piece of equipment is classified as a particular equipment class which I have pulled from an index match on the unique equipment number. I now have a set of ~9000 columns of cost data, each with a column header of one of the ~300 equipment classes.
What I want to do is to get the median, 25%, and 75% for the full data set for each of these equipment classes.
I either want to create a single long column of all the data for each equipment class, or have a way to calculate the Percentile() values for the data in all columns with the same heading.
I could filter the data for each equipment class one at a time and calculate the percentile values, but with 300 equipment classes it would take forever.
Example:
Class01 Class02 Class01 Class03 Class03
1 4 7 10 13
2 5 8 11 14
3 6 9 12 15
And I want the 25%, median and 75% for the distribution for Class01, Class02, and Class03
Thank you for your time.
I either want to create a single long column of all the data for each equipment class, or have a way to calculate the Percentile() values for the data in all columns with the same heading.
I'll just tell you how to change your data around. From there the percentiles/ quartiles will be straight forward.
Start with your data like this. Notice that I added a column on the left. It's easy to make, just type Item1 and drag down (or double click the small square in the bottom right corner of the cell)
You then need to hit Alt+D+P.
Select multiple consolidated ranges > next
Next (create page ranges for me...)
Select all of your data as the range, click add then finish
You will now get a pivot table that looks like this:
Click the grand-grand total (i.e. 120) and that will create another pivot table like this:
Et voila...

Adding a Column with Condition on Pivot Table

Been trying to figure this out for a while -
If I have a situation in which my pivot table gives me something along the lines of:
Row Labels Revenues
Panera 25
Pasta 15
Salad 10
Olive Garden 40
Sandwich 20
Pasta 20
and I wanted to insert a column next to revenues with 0's only for the rows with headers (panera, olive garden) and leave the rest of the rows for the orders blank - i.e.
Row Labels Revenues Order #
Panera 25 0
Pasta 15
Salad 10
Olive Garden 40 0
Sandwich 20
Pasta 20
is there a way to do this either in VBA, or just with a formula? Within my pivot table, the headers are labeled "restaurant name" while the subsets are labeled "orders", I was thinking about saying something along the lines of - if it's a restaurant name, insert 0, otherwise leave blank - but not sure how to do that or if there's an easier way?
If there is no overlap of names of restaurants and names of orders (i.e. you don't have a restaurant called "Pasta" for instance), you could use a formula such as
=IF(IFERROR(VLOOKUP(A3,'Sheet2'!A:A,1,FALSE),"")="","",0)
(assuming your pivot table was extracting the original data containing the restaurant name from column A of Sheet2)

Resources