MS Excel inverse lookup - excel

I have two sheets with three columns each. I need a third sheet in which I have all rows that are in sheet two but not in sheet one. Is there a formula to do this?

Here are the formulas in separate columns (for clarity). You may combine them, of course.
I used columns in a worksheet instead of separate worksheets, but the concept carries over.
Column A Column B
a d
b e
c f
d g
e h
These are A1:B6. Your data under examination are A2:A6 and B2:B6.
If I understand your question, you are looking for "f, g, h" Those are the rows in column B that are not in column A.
In C2, I place the formula =MATCH(B2,$A$2:$A$6,0). The $A$2:$A$6 means use the absolute column and row and does not change when I copy the formula down to C6. The 0 means I want an exact match.
This will put a 4 and 5 in cells C2 and C3, but #N/A in C4, C5, and C6, because there is no match.
In D2, I place the formula =IF(ISERROR(C2),B2,""). Also copy this formula to column D6. If there is a number in C2, then the a match was found, and it prints a blank. If there is a #N/A in C2, then it prints the letter in column B.
In my small example, it prints f, g, and h.
Column C Column D
4
5
#N/A f
#N/A g
#N/A h

Related

Excel formula to find unique values in column A not found in column B and list the values in column C

I have 3 columns, ColumnA, ColumnB, and ColumnC. I'd like a formula to list all unique values found in ColumnA that are not found in ColumnB.
I have created a formula based on some reference that does the job, but I think it's rather inelegant. Is there any more elegant solution?
Example of ColumnA, ColumnB, and ColumnC with values
ColumnA ColumnB ColumnC
A A D
A C B
B E
B F
D G
A
H
C
And here is my formula in cell C2, copied down ColumnC:
=IFERROR(LOOKUP(2,1/((COUNTIF(ColumnB,ColumnA)+COUNTIF(C$1:C1,ColumnA))=0),ColumnA),"")
The formula creates two arrays using COUNTIF that check for matches between ColumnA and ColumnB, and between ColumnA and previous entries in ColumnC. Because I'm looking for non-matched entries, I sum the arrays and then use a cool LOOKUP trick to output the last match in the array.
My particular use case involves an existing column (ColumnA) and a new column (ColumnB). I need to create a list of additions and subtractions. The formula above is for subtractions. I can create a formula for additions by swapping ColumnA and ColumnB.
I'd like to keep this formula as a non-array formula, and not use VBA.

Is there a formula to line up column rows based on cell value or partial value?

I have a sheet with 4 columns, see screenshot_1
Column A - word
Column C - word (column A) + extra word
The rows of Column A and column C and their values (column B and D) are not lined up. As you can see in the screenshot,
I want to place C2 And D2 on line 29, C3 and D3 on line 15, etc. So column C and D are filled with the matching word of column A (if it exists).
Resulting in something like screenshot_2
Is there a formula to line up column rows based on cell value or partial value?
Screenshot 1
Screenshot 2
You can achieve this by using wildcard in Vlookup. Enter this formula =VLOOKUP("*"&A2&"*",$F$2:$G$26,2,FALSE) in column C.
Possibly the easiest solution would be to keep columns A and B untouched, and have column C automatically display "used (whatever)" if column D contains a number.
To accomplish this, type the following formula into cell C2 and drag down:
= IF(ISNUMBER(D2),"used "&A2,"")
First, separate the ranges with some empty columns; so column A & is the same, C is empty, D & E are a not connected
Create a new column in the empty C column:
=IFERROR(IF(MATCH("*"&A2&"*",F:F,0),VLOOKUP("*"&A2&"*",F:G,2,0),""),"")
See this Example

SUMPRODUCT to get row +1

I have a table like below:
12/7/2012 A B
100
12/21/2012 A I
20
12/23/2012 A I
25
12/1/2013 A I
20
12/1/2014 A I
20
I want to get the value in column D where column B is "A" and column C is "I". I used a sumproduct to get the value in column D, but I need to go down 1 row from wherever column B is "A" and column C is "I". This is my formula:
=SUMPRODUCT(--(B:B="A"),--(C:C="I"),F:F+1).
It should return a value of 85, but it returns a value of 4.
You could use
=SUM((B1:B10="A")*(C1:C10="I")*(D2:D11))
as an array formula with CtrlShiftEnter
or
=SUMPRODUCT(--(B1:B10="A"),--(C1:C10="I"),(D2:D11))
and extend the range as far as you need to.
What happens with your formula
=SUMPRODUCT(--(B:B="A"),--(C:C="I"),D:D+1)
is that it is just adding one to each row in column D. D1, D3, D5 and D7 are empty cells so count as zero. So for the four matching rows it is adding one to the total and the result is 4.
If =SUMPRODUCT(--(B:B="A"),--(C:C="I"),D:D+1) worked it may just be coincidence. You might check by taking a copy and in that deleting D1 with Shift cells up then applying:
=SUMIFS(D:D,B:B,"A",C:C,"I")
Or of you don't have SUMIFS filter to delete rows that do not contain a date in ColumnA, A in ColumnB and I in ColumnC, then summing ColumnD.
With SUMIFS an alternative to #Tom's SUMPRODUCT might be:
=SUMIFS(D2:D1000001,B1:B1000000,"A",C1:C1000000,"I")

Compare a single row with a column and extract the value from another column on the same row in Excel

So I'm looking for a formula or anything that does something like this:
I have 4 Columns. A B C D.
I have a column (A) with multiple values that can have duplicates.
A1: A
A2: A
A3: B
A4: C
A5: C
I want to compare each row with a Column (B) that has one of each value. So B1 = A, B2 = B etc.
However the value I want to extract to column "D" is in Column "C". So if A1 equals anything in the Column B, I want to extract the value in Column C on the same row, to Column D.
So in D1 I want the value from C1. In D2 I want the value from C1 as well. But in D3 I want the value from C2.
This seems to work:
=VLOOKUP(A1:A5,B1:C5,2,0)
Entered as Array Formula in D1:D5 using Ctrl+Shift+Enter.
Result:

looking for excel formula combining columns and rows

Imagine a spreadsheet with 4 columns: A B C D
If the B column is equal to D column, I want in column A the result of column C
for example: if B2 is equal to D2, A2 value should be C2 value
if not equal it should show empty or false or something
I have uploaded a sample spreadsheet
What is the formula to use?
In cell A2, simply put:
=IF(B2=D2,C2,FALSE)
And fill down for the other rows.
The logic should be simple enough to understand. And you can type in something else instead of FALSE if you want.
EDIT:
As per amendment of problem:
First move the column D before column C (meaning Email will be in Column C and Log will be in column D)
In cell A2, put the formula =VLOOKUP(B2,C:D,2,0)
Fill the formula down.
This would go in A2.
=IF(B2=C2,C2,"")

Resources