Looking up data in two columns - excel

I have a question regarding the vlookup function or any other ways which could help me derive to this outcome.
I have 3 columns of data, A,B & C.
I would like to identify any data in column A that comes up in column C.
Then, I would like the new column D to reflect the data in column B in the same row as the match found in column A.
I am sorry if this is confusing.
Here is the example;
A1 - 1
A2 - 2
A3 - 3
A4 - 4
A5 - 5
B1 - abc
B2 - def
B3 - ghi
B4 - jkl
B5 - mno
C1 - 2
C2 - 4
C3 - 5
C4 - 7
C5 - 9
I would like D to look for a match from column C in column A and reflect the data in column B.
This would be the result I need.
D1 - def
D2 - jkl
D3 - mno
D4 -
D5 -

This can be done with a simple VLOOKUP formula - enter this in D1 and copy it down:
=VLOOKUP(C1,A:B,2,0)
Even better than VLOOKUP is INDEX/MATCH, i.e. this formula:
=INDEX(B:B,MATCH(C1,A:A,0))
Both approaches lead to the same result, the later is a bit more robust when you change your sheet structure.

Related

Matching cell from two values

need help here :) I am not excel expert
I have a simple spread sheet with some data and I need to find the matching values from another sheet. Some help would be appreciated.
The data looks like this:
d1 d2 d3 d4 d5
c1 1 5 4 4 3
c2 2 4 9 1 2
c3 4 4 7 8 4
c4 4 7 1 9 2
c5 4 4 7 6 8
So above c1, c2 etc. means Code's and d1, d2 etc. means Dates (future dates).
The numbers between I need to catch in a different spread sheet
example
Code: c2 - User provides the code
Date: d4 - User provides the date
Value: 1 - this value I need to get with formula
Should I attach example file if needed?
If possible to use performance wise formulas as might be quite few of them. Perhaps INDEX/MATCH? if I know how to use it :) but I think also INDEX/MATCH will slow it down a lot, I might be wrong also :)
thank you for your help in advance.
EDIT:
Added screenshot, might help also what is needed.
Assumptions / prerequisites:
Sheet1 cells (A1:F6) is your data / headers from your example
Sheet2 cell B3 is where the user types the code
Sheet2 cell B4 is where they type the date
Sheet2 cell B5 is where the value displays
this would be your formula in Sheet2 C5
=INDEX(Sheet1!A:F,MATCH(B3,Sheet1!$A:$A,0),MATCH(B4,Sheet1!1:1,0))

Fill blank cell in Excel with value with same ID

I'm not so advanced in excel I need help if is it possible to do.
I have an excel with this column:
ID - Value1 - Value2
I need to update the value1 (or value2):
- only if are blank AND only if the row has the same ID
I make an example, I have this table:
ID Value1 Value2
A1 1 100
A2 2
A3 3
A4 1 200
A5 2 250
Iwould like to fill all the empty cell in this way
ID Value1 Value2
A1 1 100 200
A2 2 250
A3 3
A4 1 100 200
A5 2 250
Thank you for any help.
Ok, so your data is a mixture of numbers and texts. You can generate two new columns with the desired values using formulas. Choose two new, adjacent columns, say D and E, and enter this CSE formula in row say in cell D2:
D2:
=IFERROR(IF(ISBLANK(B2),INDEX(B$2:B$99,
MATCH(1,($A$2:$A$99=$A2)*(1-ISBLANK(B$2:B$99)),0)),B2), "")
CtrlShiftEnter
Enter the formula in D2 with CtrlShiftEnter and then copy/paste in the cells of columns D and E (or as I said any two adjacent columns).

How to match columns and adding blank rows in excel

I have an excel file with 5 rows in column A and B, and 3 in column C and D (in reality though, I have a couple of hundreds of rows). Column B consists of text belonging to A, and D of text belonging to C. Column C has some of the values found in column A.
It looks like this:
A B C D
1 1 stringA1 1 stringC1
2 2 stringA2 2 stringC2
3 3 stringA3 4 stringC3
4 4 stringA4
5 5 stringA5
Now, I would like to match the numbers in column C with those in A, so that matches are put in the same row. For those rows in A for which there is no match in C, I want to have blank cells after column B.
It would look like this in this case:
A B C D
1 1 stringA1 1 stringC1
2 2 stringA2 2 stringC2
3 3 stringA3
4 4 stringA4 4 stringC3
5 5 stringA5
I have some idea that I should use VLOOKUP and maybe Conditional Formatting, but unfortunately I am not very experienced in excel. Could someone please suggest a way to do this?
Enter the following formula in Cell E1:
=IF(IFERROR(MATCH(A1,$C$1:$C$5,),"")<>"",INDEX($C$1:$D$5,IFERROR(MATCH(A1,$C$1:$C$5,),""),1),"")
and this one in Cell F1:
=IF(IFERROR(MATCH(A1,$C$1:$C$5,),"")<>"",INDEX($C$1:$D$5,IFERROR(MATCH(A1,$C$1:$C$5,),""),2),"")
Using Helper Column:
You can also do this using a helper column.
In Cell E1 write:
=IFERROR(MATCH(A1,$C$1:$C$5,),"")
Then in Cell F1 write:
=IF(E1<>"",INDEX($C$1:$D$5,E1,1),"")
And finally in Cell G1 write:
=IF(F1<>"",INDEX($C$1:$D$5,E1,2),"")
This was answered by #user3514930 to a question here.
You can directly use this formula in D2 and copy downwards:
=IF(A2 = C2, A2, "")
Now if you have formulas in A2, C2, type in those formulas in place of A2, C2 in the above.

Sum fields in a column if there is an entry in a corresponding row in another column

Assume the following data:
| A B C
--+------------------------
1 | 2 3 5
2 | 2 3
3 | 4 4
4 | 2 3
5 | 5 6
In cell A6, I want Excel to add cells C1, C2, C3 on the basis that A1, A2 and A3 have data in. Similarly, I want B6 to add together C1, C4 and C5 because B1, B4 and B5 have data.
Can someone help?
In A6 enter:
=SUMPRODUCT(($C1:$C5)*(A1:A5<>""))
and then copy to B6:
A simple SUMIF formula will work
=SUMIF(A$1:A$5,"<>",$C$1:$C$5)
Place that formula is cell A6 and then copy it to B6.
You can create another column, e.g. AValue, with the formula =IF(ISBLANK(A1),0,A1) in it. This will return 0 if the cell in A in the corresponding line is empty, or the value from the cell in A otherwise.
Then you can just sum up the values of the new column.

extract data from column based on subset of data from other other column

This is how my data looks like:
C1 C2 C3
1 1 a
2 2 a
3 3 a
4 4 a
7 5 a
8 6 a
9 7 a
10 8 a
9 a
10 b
You see that C1 is a subset of column C2. I want now to extract only the data from C2 - together with the corresponding value from C3 - that matches C1. The extracted data just needs to be copied to another column
Could someone give me a hand?
Assuming your data in C1 starts from A2, do the following:
Type in cell D2 (column C4): =IFERROR(VLOOKUP($A2,$B:$C,1,0),"")
Type in cell E2 (column C5): =IFERROR(VLOOKUP($A2,$B:$C,2,0),"")
Autofill both formulas.
This will give you what you want, missing values will be shown as blanks. If you want concatenate both parts of out - just put the aggregate formula =ISERROR(...)&ISERROR(...) to any column row 2 you like.
Sample file: https://www.dropbox.com/s/qglyxmu3tkfxy7g/DataExtract2Cols.xlsx

Resources