Excel - Combine multiple columns into one column 3 - excel

What is the formula that we can use in Microsoft Excel to get the result of the value summation from string column A and string Column C if they are the same? Column B and Column D are both the number that assign to its respective column which is Column A and Column C. For example “orange” holds the value 6 (in Column B) for Column A while in Column C “orange” hold the value 2 (in column D).Final results should show the summation of 6+2=8 (in Column F) for string ‘Orange’ (Column E).
Thank you
Lupe

If you have this table:
A B C D
orange 1 orange 6
apple 2 apple 7
grapes 3 carrot 8
carrot 4 melon 9
And you want to search in column C for each of the A column values, you should use this in column E: (for E2, and drag down)
=IFERROR($B2+VLOOKUP($A2,$C$2:$D$5,2,FALSE), 0)
make sure to change $C$2:$D$5 to your range (in both places).
A B C D E
orange 1 orange 6 7
apple 2 apple 7 9
grapes 3 carrot 8 0
carrot 4 melon 9 12

Related

Excel: Sort column to match values of another column

I've got a problem with an excel sheet with 4 columns where two columns rely on each other because Column A is the name and column B is the quantity, the same thing with columns C and D.
Table
==========================================
A B C D
Apple 54 Banana 12
Peanut 6 Pineapple 4
Cranberry 112 Cherry 40
Cookie 3 Peanut 4
Banana 2 Cranberry 5
Peach 3 Almond 10
Cherry 5
Cheese 10
What I want to get is that each content of column C with the quantity in column D will be placed in the same row as their matching part in column A so I can compare the quantities between B and D. All the values with no matching partner should be placed at the bottom or just with an empty table, so I know there is no match.
Example how it should look like:
Table
==========================================
A B C D
Apple 54
Peanut 6 Peanut 4
Cranberry 112 Cranberry 5
Cookie 3
Banana 2 Banana 12
Peach 3
Cherry 5 Cherry 40
Cheese 10
Almond 10
Pineapple 4
This should solve your problem: =VLOOKUP(C2;$A$2:$B$9;2;TRUE)
You simply add this as a column "E" in your spreadsheet and drag it down then you can compare the values.
Col A remains as it is.
Col B remains as it is.
Col C moves to Col E.
Col D moves to Col F.
New Col C, Cell C1 = =IFS(AND(A1<>"",(COUNTIF($E$1:E, A1)=1)=TRUE),A1,AND(A1<>"",(COUNTIF($E$1:E, A1)=1)=FALSE),"",A1="",ArrayFormula(INDEX($E$1:E,SMALL(IF(ISERROR(MATCH($E$1:E,$A$1:A,0)),(ROW($E$1:E)-MIN(ROW($A$1:A))+1),""),SUM(ROW(1:1)-COUNTA($A$1:A1))))))
Copy this down from C1
New Col D, Cell D1 = =IF(C1="","",VLOOKUP(C1,$E$1:F,2,FALSE))
Note: I wrote this in Google sheets, So when I type ctrl + shift + enter it coverts it into ArrayFormula(). You will need to do an array formula the excel way - ctrl + shift + enter and remove the ArrayFormula().
Feel free to view this in a sheet - https://docs.google.com/spreadsheets/d/10hygbPyzj7L1u77izejoeGriaquoZ_omp49pCJ2U7uE/edit?usp=sharing
If you want to export the sheet. Right click the "sheet 1" tab, go to "copy to" and "new spreadsheet"
Any questions, let me know :)

Excel index ,if and And

I have two sheets in excel. Sheet1 has A, B, C and D columns. Sheet2: A, B, E as columns. I want compare Sheet1 and Sheet2 columns (A&B) and write C from Sheet1 only if A&B in both sheets matches.
Eg:
Sheet1
A B C D
Sheet2
A B E
Add column C in Sheet2 only if A&B columns in both sheets matches
You can use vlookup function.
In Sheet1 you need to make a new column consisting of a and b at the beginning, for example:
Sheet1:
A B C
1 2 a
2 3 b
4 6 c
Sheet1 after changes:
new_column_A old_A B C
12 1 2 a
23 2 3 b
46 4 6 c
New_column_A can be created using formula =old_A1&B1
If you have this in your Sheet1 you can use vlookup function in your Sheet2 in column C to look for the values from Sheet1.
Sheet2
A B C
2 3 b
1 3 #N/D!
4 6 c
5 8 #N/D!
Your formula for C column would look like that:
=VLOOKUP(A1&B1,Sheet1!$A$1:$D$4,4,0)
If you don't want the #N/D! values you need to add IF condition:
=IF(ISERROR(VLOOKUP(A1&B1,Sheet1!$A$1:$D$4,4,0))=TRUE,"",VLOOKUP(A1&B1,Sheet!$A$1:$D$4,4,0))
Result:
A B C
2 3 b
1 3
4 6 c
5 8

Increment value in Excel column depending on existing values in other column

I have 4 columns in Excel: A, B, C, and D. I want two of the columns (C & D) to auto-populate based on the input in the other two columns (A & B). The first column that auto-populates (C) should start at 1 and increment each time a new value is added in the same row of column B. Column D should also start at 1 and increment each time a new value is added in the same row of column B, however, if column A has the same value as the previous row (i.e., a date) then it should not increment but instead be the same value as column D in the previous row. Additionally, if a value in column B is repeated, but with a different value (i.e., a date) in column A, then it's corresponding value in column C should be the same as before, but the value in column D should still increment because the value in column A is new.
To visualize:
A B C D
Jan. 5 red 1 1
Jan. 5 gre 2 1
Jan. 6 pin 3 2
Jan. 6 pur 4 2
Jan. 7 bla 5 3
Jan. 7 blu 6 3
Jan. 8 red 1 4
Jan. 8 gre 2 4
Jan. 9 yel 7 5
Jan. 9 ora 8 5
I hope this makes sense. Any help would be greatly appreciated!
Assuming "A" is in cell A1, hardcode 1 in C2 and D2 then in C3 and downwards:
=iferror(index($C$2:$C2,match(B3,$B$2:$B2,0)),max($C$2:$C2)+1)
and in D3 and downwards:
=if(A3="","",if(A3=A2,D2,max($D$2:D2)+1))

A function that will lookup a reference

Before I get started thanks for taking your time and helping.
This is what my worksheet looks like:
Row # B C D E F
2 1 Product 1 B2 B3 B4
3 2
4 6
5 1 Product 2 B5 B6
6 5
7 4 Product 3 B7
I was trying to follow this formula: (The best answer one or green check mark) return values from multiple matching rows
I got all the way to the =IFERROR(INDIRECT(lookups!H5),"") but can not get this to work.
What I am tying to do is order the numbers in Column B to go to the right of the product. Which I was able to get the column it is in (B) and the row number it is in (B2). I would like to change the value (B2) to the number that is there.
I would like it to look like this:
Row # C D E F
2 Product 1 1 2 6
3
4
5 Product 2 1 5
6
7 Product 3 4
If someone could help explain this to me or find a better way that would be great.
Not sure what is to happen to columnB but if you replace B with "="B throughout columns D:F then select each of these in turn and apply Text to Columns with Tab as the delimiter the 'cell references' convert to formulae referring to the values in B. If you want to delete columnB copy D:F and Paste Special, Values over the top.

Comparing Multiple Cells and Returning Values

I have a spreadsheet that looks like this:
A B C D
1 Bob 10/02/2013 10
2 Bob 10/02/2013 2
3 Bob 10/02/2013 8
4 Steve 10/01/2013 6
5 Steve 10/01/2013 6
6 Sally 10/01/2013 6
The requirement is that if A1 matches anything else in column A (A1,A2, and A3) AND B1 matches anything in column B (B1,B2,B3) Then add up the values C, divide by 4 and put that in D.
I want to do this for the whole sheet (500ish rows).
You may use the SUMIFS function. Below is sample.
Formula =SUMIFS(C1:C5,A1:A5,A1,B1:B5,B1)
OR
Or can use SUMPRODUCT function .
=SUMPRODUCT($C$1:$C$5,--($A$1:$A$5=$A1)*--($B$1:$B$5=B1))/4

Resources