Excel index ,if and And - excel

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

Related

Find row number of first occurrence of blank cell if conditions met

I need to search for the row number for the first occurrence of a blank cell if conditions are met. In the first column, it will need to find a 'T' and then in the 'Answer' column, a blank cell.
=MIN(IF(ExamTbl[UnLockedField]="T",IF(ExamTbl[Answer]="",ROW(ExamTbl[Answer])-ROW(ExamTbl[#Headers]),0)))
The formula I used just returns a 0 but in the picture, I am expecting 15 as that is the first blank cell that matches against a 'T'.
I have created following Excel sheet:
A B C D
1 H a
2 H <BLANK>
3 H <BLANK>
4 T b
5 T <BLANK>
6 T <BLANK>
7 H c
8 H d
In C1:C8, I've put following formula:
=IF(AND(A1="T",ISBLANK(B1)),1,0)
In D1, I've put the formula:
=MATCH(MAX(C1:C8),C1:C8,0)
In other words:
In column "C" I put a 1 if both "A" column value is "T" and "B" column value is blank.
In column "D" I look for the maximum value in "C" column (being 1) and ask for the first match, using exact match (hence the zero at the end).
So my sheet becomes (values):
A B C D
1 H a 0 5
2 H <BLANK> 0
3 H <BLANK> 0
4 T b 0
5 T <BLANK> 1
6 T <BLANK> 1
7 H c 0
8 H d 0
The 5 in "D1" is what you are looking for.

Excel 2019: Copy data from sheet2 columns B, C, D to sheet1 columns B, C, D based on value of sheet1 column A

I have the following conditions:
I have a Workbook with 2 WorkSheets named Data and Users
In Data, I have column A populated with numbers ranging from 1 to 9999999
In Users, I have column A populated with numbers ranging form 1 to 9999999
In Users, I have multiple rows of each of the numbers (example 10 rows of 1, 18 rows of 2, 32 rows of 3, etc.)
In Data, cells B, C and D are empty
In Users, cells B, C and D contain email, first name, last name
What I am trying to do is to copy Users : B, C and D values to Data : B, C and D empty cells.
I'm trying to use the INDEX and MATCH functions, but cannot get it to run - continually getting errors.
Here is an example of what I've tried in a test cell in my Users sheet:
=INDEX(Users!A:A,MATCH(1,(A2=Data!:A:A),0))
So, to clarify.
I have:
Users sheet:
A B C D
1 me#me.com First Last
Data sheet:
A B C D
1
1
1
1
My objective is to populate every row in Data with the values of Users B, C and D whenever the value in column A matches.
The end result would look like:
Data sheet:
A B C D
1 me#me.com First Last
1 me#me.com First Last
1 me#me.com First Last
1 me#me.com First Last
Thanks in advance.

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))

Match value based on criteria in two columns

I have the following values in columns A, B and C.
A B C D
3 3 5
4 4 10
In cell D1, how can I find the value in Column C where A=A+1 and B=B+1 i.e. 10?
Are you looking for something like below?
=VLOOKUP(SUM(A1+1,B1+1),C:C,1,FALSE)

how to get such results using excel formula

i have two excel sheets
An example of the two sheets are below
sheet1
a 1
b 2
d 1
e 3
g 1
sheet2
a
b
c
d
e
f
i want to put a formula in b1 of sheet 2 and drag it down so that the resulting sheet 2 is
sheet2
a 1
b 2
c 0
d 1
e 3
f 0
explanation : - a = 1 because same value in book1
b = 2 because same value in book1
c = 0 because c does not exist in book1
d = 1 because same value in book1
e = 3 because same value in book1
f = 0 because f does not exist in book1
what formula can i use in b column of sheet 2 ?
A combination of if(), iserror() and vlookup() will be your best bet here.
Assuming your data from sheet1 is in a range called 'refdata',
=IF(ISERROR(VLOOKUP(A1,refdata,2,FALSE)),0,VLOOKUP(A1,refdata,2,FALSE))
should do what you need (Where A1 is the cell containing the data you want to match on)
In Excel 2007 it looks like this:
=IFERROR(VLOOKUP(A1,sheet1data,2,0),)

Resources