How to match different charts - excel

Below I have two charts, the first does not have the value of calories, the second does. (The values are arbitrary - this is just an example.) I need to find a way to fill in the value of the calories in the first chart by matching all the values of wheat, flour, barley, and rye with the second chart. If all the values match, then I need it to copy that number of calories into the first chart. For example, row 2 has matching values with row 13, so I need to copy 100 calories into the E2 cell.
Does anyone have a formula that can do this?
A B C D E
1 Wheat Flour Barley Rye Calories
2 1 0 0 2
3 4 2 4 0
4 1 4 5 2
5 0 3 2 1
6 1 6 8 9
10 KEY
11 A B C D E
12 Wheat Flour Barley Rye Calories
13 1 0 0 2 100
14 0 3 2 1 150

Insert a column between Rye and Calories, in E12 enter =A12&B12&C12&D12 and copy down to suit.
In F2 enter =VLOOKUP(A2&B2&C2&D2,E$13:F$14,2,0) (or extend range if required) and copy down to suit.
This assumes both arrays are in the same sheet.
Tidy up by selecting ColumnF, Copy, Paste Special..., Values over the top and then delete ColumnE.

I'm new so can't post pics... I added a column to be the new A column that details different weight measurements (1.0 grams, 1.25 grams etc)
In cell B3 (or whatever cell is directly under Wheat at the top, paste the following and then paste over and across:
+IFERROR(INDEX($B$9:$F$16,MATCH($A3,$A$9:$A$16,0),MATCH(B$2,$B$8:$F$8,0)),0)
where $B$9:$F$16 is your whole table of original data
where $A3 is your identifier in your top chart (1.0 grams in my example)
where $A$9:$A$16 is the range in your data chart that lists gram measurements (1.0 grams - 10.0 grams or whatever)
where B$2 is Wheat in top chart
where $B$8:$F$8 is Wheat to Calories in bottom chart.
Hope this helps.

Related

How to retrieve a list of cells with a specific value from a column, and display the text content of another column into another sheet?

I have a spices "Inventory" sheet with Column A "Product" and Column B "Stock". I would like to retrieve the names of the spices from "Product" based on a certain stock value from "Stock", say 0, or any other criteria (<=5), and display the names of the pices from "Product" into another sheet.
A B
1 Product Stock
2 Cinnamon 3
3 Cassia 0
4 Fennel 1
5 Aniseed 0
6 Star Anise 0
7 Liquorice 1
8 Clove 7
9 Allspice 0
10 Vanilla 1
11 Tonka bean 1
I have tried a combination of INDEX MATCH and it does work partially but not in the concise and clean way I was expecting. THis is my formula so far:
=INDEX(Inventory!A2:A11,MATCH(0,Inventory!B2:B11,0))
And this is what I get when I drag the formula down to extend the selection:
D
1 No Stock Prods
2 Cassia
3 Cassia
4 Aniseed
5 Aniseed
6 Star Anise
7 Allspice
8 Allspice
9 Allspice
10 #N/A
11 #N/A
So it does bring those entries with value 0, but it keeps retrieving the same values as the formula moves down the sheet until it finds another match, and so on.
This is what I want, only the names of products with stock 0, without repeating names or errors:
D
1 No Stock Prods
2 Cassia
3 Aniseed
4 Star Anise
5 Allspice
To get the values equivalent to 0 in column B, in D1 enter:
=IFERROR(INDEX($A$1:$A$11,AGGREGATE(15,6,ROW($1:$999)/($B$1:$B$11=0),ROW(1:1)),),"")
and copy downward:
To use a different criteria, just replace the factor:
($B$1:$B$11=0)

Concatenating INDEX/MATCH with multiple criteria and multiple matches

I am using Excel to track a team game where players are divided into teams and subteams within teams. Each player within a subteam scores a certain number of points, and I would like to have a summary string for each player with the number of points other players in the same subteam scored.
Example:
A B C D
PLAYER TEAM SUBTEAM POINTS
Alice Red 1 70
Bob Red 1 20
Charlie Red 1 10
Dave Red 2 70
Erin Red 2 30
Frank Blue 1 55
Grace Blue 1 45
My desired output looks like this:
A B C D E
PLAYER TEAM SUBTEAM POINTS SUMMARY
Alice Red 1 70 Bob:20, Charlie:10
Bob Red 1 20 Alice:70, Charlie:10
Charlie Red 1 10 Alice:70, Bob:20
Dave Red 2 70 Erin:30
Erin Red 2 30 Dave:70
Frank Blue 1 55 Grace:45
Grace Blue 1 45 Frank:55
The furthest I was able to go is a combination of CONCATENATE, INDEX, and MATCH in an array formula:
{=CONCATENATE(INDEX($A$2:$A$8,MATCH(1,(C2=$C$2:$C$8)*(B2=$B$2:$B$8),0)), ":", INDEX($D$2:$D$8,MATCH(1,(C2=$C$2:$C$8)*(B2=$B$2:$B$8),0)))}
This unfortunately just outputs a summary for the first player in the subteam:
A B C D E
PLAYER TEAM SUBTEAM POINTS SUMMARY
Alice Red 1 70 Alice:70
Bob Red 1 20 Alice:70
Charlie Red 1 10 Alice:70
Dave Red 2 70 Dave:70
Erin Red 2 30 Dave:70
Frank Blue 1 55 Grace:45
Grace Blue 1 45 Grace:45
What I need to do now is:
Excluding the player for the summary (I don't want Alice in the summary for Alice, but only Bob and Charlie)
Getting it to work for multiple matches (there can be an arbitrary number of players in each subteam)
Getting CONCATENATE to work with an unknown number of strings (because as said above, there can be an arbitrary number of players in each subteam).
Ideas appreciated!
I put together a helper column that concatenates each player/points and the TEXTJOINIFS from TEXTJOIN for xl2010/xl2013 with criteria for the desired results.
Unfortunately Excel (prior to Excel 2016) cannot conveniently join text. The best you can do (if you want to avoid VBA) is to use some helper cells and split this "Summary" into separate cells.
See example below. The array formula in cell E4 is dragged to cell J10.
= IFERROR(INDEX($A$4:$D$10,MATCH(SMALL(IF(($B$4:$B$10=$B4)*($C$4:$C$10=$C4)*($A$4:$A$10<>$A4),
ROW($A$4:$A$10)),E$3),ROW($A$4:$A$10),0),MATCH(E$2,$A$1:$D$1,0)),"")
Note this is an array formula, so you must press Ctrl+Shift+Enter instead of just Enter after typing this formula.
Of course, in this example I assume 3 players. Your requirement of arbitrary amount of players cannot be met with formulas alone, but you can just extend the "Summary" section over to the right as far as necessary.
If you really wanted to, you could even concatenate the "Summary" rows to form a single cell, e.g. something like:
= CONCATENATE(E4,": ",F4,", ",...)

Excel macro store value of vlookup and then add them up

So I have the following sheet setup:
Sheet 1
A B C
Tomatoes 100 50
Onions 20 0
Garlic 10 0
Chicken 0 100
Cheese 0 20
Where each column after A is a recipe and going down is the amount of grams required in the recipe of the ingredient.
Sheet 2 has cost per 100 grams per ingredient like so:
A B
Chicken 10
Tomatoes 1.5
Onions 2.25
What I'd like to do, is at the bottom of sheet 1 (ideally) under each column I could have the cost for the recipe.
In my mind it's broken down into 2 steps. Step 1 is do a vlookup from Sheet 1 to replace the grams to cost. Then do a sum of the entire column. I just don't know how to do that either in a macro or formula.
Refer the below specified link,
https://www.ablebits.com/office-addins-blog/2014/08/05/excel-vlookup-sum-sumif/#lookup-sum
You can download their worksheet here

excel data transposition using built in formulas

Heres the issue I have a dump from the database at work that is in a rather conveluted format. Basically it does not give you the displayed information as much as just the individual relation tables to work with.
EXAMPLE: lets say I have the following columns of information
ID, COLOR, SIZE, QTY, TYPE
the information looks something like this
ID COLOR SIZE QTY TYPE
A brown 20 1 1
C yellow 10 2 2
D brown 40 5 1
A blue 70 1 3
A yellow 80 1 2
B yellow 20 4 1
D blue 70 4 2
C blue 10 3 1
what i need is something more like this
ID BROWN SIZE TYPE BLUE SIZE TYPE YELLOW SIZE TYPE
A 1 20 1 1 0 3 1 80 2
B 0 0 0 0 0 0 4 20 1
C 0 0 0 3 10 1 2 20 1
D 5 40 1 4 0 2 0 0 0
I most like could accomplish this with an excel formula, possibly the one called sumifs but i can not seem to get it to work any help with this would be greatly appriciated.
You can do this by using a combination of SUM and IF in array formulas.
Assuming that your data table starts in cell A1 and your result table starts in cell A11, begin by entering the following formulas in cells B12, C12 and D12 respectively, making sure to use the CONTROL-SHIFT-ENTER key combination to enter them.
B12 =SUM(IF($B$2:$B$9=B$11,IF($A$2:$A$9=$A12,$D$2:$D$9,0)))
C12 =SUM(IF($B$2:$B$9=B$11,IF($A$2:$A$9=$A12,$C$2:$C$9,0)))
D12 =SUM(IF($B$2:$B$9=B$11,IF($A$2:$A$9=$A12,$E$2:$E$9,0)))
Copy the cells down to the bottom of your data table, which in this example would be row 15.
Then copy the block of formulas you have created to cell E12, where the BLUE section of the result table starts. Then copy the same block of formulas to cell H12, where the YELLOW section of the result table starts.
This solution assumes that you have no duplicate combinations of ID and COLOR in your data table and that no combinations are missing. If there are missing combinations of ID and COLOR, you would need to wrap the formulas in an IFERROR function (in Excel 2010).
The way I'd transpose a data table would run like this...
Your example is a bit more complicated so I'm not going to use your full data, just go with size. Begin by creating a column called Index
A B C D
INDEX ID COLOR SIZE
=A3 & "-" & B3 A brown 20
=A4 & "-" & B4 C yellow 10
. D brown 40
. A blue 70
. A yellow 80
. B yellow 20
D-blue D blue 70
C-blue C blue 10
Create a table equivalent which combines the header row with the ID column
F G H I
ID brown blue yellow
A =$F2 & "-" & G$1 . .
B . . .
C . C-blue C-yellow
D . D-blue D-yellow
Finally wrap this up in a VLOOKUP or an OFFSET(MATCH(_)) with possible an IFERROR
ID brown blue yellow
A =IFERROR(VLOOKUP($F2 & "-" & G$1,$A$3:$D$10,4,FALSE),"Err")
B . . .
C . 10 10
D . 70 Err
Anyway that is how I generally do this sort of transform

How in Excel change the direction of numbers (from right (0) to left (100))?

I have a line of numbers from 0 to 100. They follow each other like usual:
1 2 3 4 5 6 7 8 9 10 ... and so on --> ... 100
But I need to change their direction from right to left, like this:
100 <-- and so on ... 10 9 8 7 6 5 4 3 2 1 0
Is there some special tool for this operetion?
Each number is in its individual cell and horizontally: 1 in [A1], 2 in [B1], 3 in [C1], and so on.
If this is exaclty what you need, you can simply enter 100 in A1, 99 in B1, select the 2 cells and drag the formula to the right (by clicking on the little square at the bottom right of the selected range).
If your actual problem is a bit more complex and you need to sort the data in descending order, you could:
transpose it to make it vertical (Copy / Paste Special and select transpose)
sort the data set with the standard sorting feature
transpose it again back to its original range

Categories

Resources