VLOOKUP issue in Excel - excel

I have the following basic VLOOKUP setup, having not used Excel in anger for a while. I am looking up the values a, b and C in a table containing two columns.
<value returned> <expected>
a 1 b =VLOOKUP(A1,C$1:D$1,1,FALSE) #N/A #N/A
b 2 c =VLOOKUP(A2,C$2:D$2,1,FALSE) #N/A 2
c 3 d =VLOOKUP(A3,C$3:D$3,1,FALSE) #N/A 3
I am getting #N/A returned for all rows (as shown to the right), but I would expect the values to the right again to be returned. Can someone please explain what I have done wrong?
Thanks

If you still stick to dataset :
a 1 b
b 2 c
c 3 d
then : =INDEX($C$2:$C$4,MATCH(A1,$D$1:$D$3,0))
So if you re-arrange the data as :
a 2 b
b 3 c
c 4 d
then use : =INDEX($C$1:$C$3,MATCH(A1,$D$1:$D$3,0))
hope that helps. (:

When using VLOOKUP, the column containing the key to be matched has to be the first column on the left of the range. So change your data layout to this:
A B C D
a b 1
b c 2
c d 3
and use the following formula:
=VLOOKUP(A1, C$1:D$3, 2, FALSE)
and then it should work. As #Scott mentioned in his comment, if you want to keep your data layout the same, you could look into using INDEX.

Related

Ignore text values in subtotal function

Excel-Sheet:
A B C D E
1 1.200
2 Product A 500
3 Product B 400
4 Product C OK
5 Product D #NA
6 Product E 300
7
8
In the above table I have list of products in Column A and some data about the products in Column B.
In Cell B1 I want to calculated the subtotal of Column B using =SUBTOTAL(9,B2:B6).
However, now I have the issue that Column B not only consists of numbers.
It can also have the data type text (OK, NA). Therefore, the result in Cell B1 currently is #NA.
Is there any kind of formula that I could use so only the number data is considered and the result is 1.200 as in the table above?
Please note:
This function =AGGREGATE(9,6,B2:B6) won't help me because I want to filter the list later on so I need to go with the SUBTOTAL.
Use 7 as the second criterion in AGGREGATE instead of 6 as it will also exclude hidden rows:
=AGGREGATE(9,7,B2:B6)
You can solve this, combining the Excel worksheet functions =Value() and =IfERROR():
The function =Value() gives the value of a number, and in case of text it gives an error.
=IfError() can be used to give 0 in that case.
So, imagine you have following situation:
Column A Column B Column C
1 =Value(A1) =IfError(B1;0)
3.5 =Value(A2) =IfError(B2;0)
AB =Value(A3) =IfError(B3;0)
abc10 =Value(A4) =IfError(B4;0)
This gives following results:
Column A Column B Column C
1 1 1
3.5 3.5 3.5
AB #Value 0
abc10 #Value 0
You can simply take the sum of column C.
So this is based on the summary in B1.
=SUM(IF(ISERROR(B2:B6),"",B2:B6))
You need to push Ctrl+Shft+Enter for this to work.
Hope it helps.

SUMIFs in Google sheets with 2 filters on same criteria range

I have looked at various answers but all use filters on different columns. I need an OR type filter like this:
=SUMIFs(B2:B22,C2:C22,"Incurred",C2:C22,"Expected")
Where C2:C22 specifies if the cell in B is an incurred or expected or deferred expense.
How do I do this? Note the filters are on the same set of cells in column C.
This is the data in A6:C6:
1 A C
2 B D
3 A D
4 B C
5 A D
6 B D
To sum the values if column B is A or column C is D you can use:
=SUM(ARRAYFORMULA((IF(((B1:B6="A")+(C1:C6="D"))>0,A1:A6))))
This uses the fact that True equals 1 and False equals 0 once you want to use them in equation.
You may try this...
=SUMPRODUCT(((C2:C22="Incurred")+(C2:C22="Expected")+(C2:C22="Deferred"))*B2:B22)

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 return multiple values using index/match?

I have the below simple table:
A 1
B 2
C 2
D 1
Using an index/match formula, I have set it up so that it only looks at one row at a time.
However, when I drag this formula down and ask it to return where the second column is a 2. I receive N/A at the top and bottom of my lookup.
Is there a way for me to ask it to skip when there is a NA or return multiple rows?
Here is my code:
=INDEX(B2,MATCH(1,C2))
Which returns:
A 1 A
B 2 #N/A
C 2 #N/A
D 1 D
I would like it to return:
A 1 A
B 2 D
C 2
D 1
So skiiping rows where there is no match.
The easiest way to have it skip what the value is NA is to either put an IF statement
=If(A1 = "NA","",INDEX(MATCH))
or
If it is NA because it is not finding a match
=IFERROR(INDEX(MATCH),"")
one of those 2 should do it. If not please post your code.

Excel - countif()

i am having troubles with the excel function Countif.
I got 2 columns A and B and they should contain (almost) the same entries - which is what i am testing for and i need to know which entries are different. Order does not matter.
columns are actually tickers and look like this
http://pastebin.com/zHdJ5ndp
ok, so i use countif to identify the entries of column B which are not in column A.
Countif(A:A;B1)
Countif(A:A;B2)
...
The result is a column full of zeros, which is just not correct.
other simple tests like
a a 1
b b 1
c c 1
d d 1
e e 1
f f 1
g g 2
g h 0
work just fine!
What am I doing wrong right here?
Thanks in advance!
Are you sure the data in column A and B is the same (no extra space etc)?

Resources