Formula is is resulting to the left - excel

I have a Vlookup with a Match. The Vlookup looks for a country and the match looks for a weight. Each weight for different countries has a different cost.
My formula seems to return the result to the left of what I would expect. So 65kg is returning the cost of 60kg.
This is the code that I have used. I have tried including 1+ in front of D9. I have had False as 0 and I have tried changing the 0's to 1 and -1.
"=VLOOKUP(D8,Express!C2:AU128,MATCH(D9,Express!D3:AU3,0),FALSE)"
Hope this makes sense.
Thank you for any help.

Match returns the relative position in the range. so the fact that the third criterion in the VLOOKUP is 1 based not 0 based you need to start the range in the MATCH with the same column as in the VLOOKUP:
Change Express!D3:AU3 to Express!C3:AU3
=VLOOKUP(D8,Express!C2:AU128,MATCH(D9,Express!C3:AU3,0),FALSE)

Try this formula:
=VLOOKUP(D8,Express!C2:AU128,MATCH(D9,Express!D3:AU3,0)+1,FALSE)

Related

INDEX & MATCH in excel

I have this table in excel
I want to create a new column where if have a total score let's say of 92 I do an index/match on the table and get it.
I tried this
=INDEX('Risk Assessment Matrix '!I24:I28,1,1,MATCH(111,'Risk Assessment Matrix '!J24:J28,0))
but not working.
Any help please?
Thanks,
Ilias
Assuming a value given is not above 140, you don't even need a 3rd column. Try:
Formula in D2:
=INDEX(A1:A5,MATCH(D1,B1:B5,-1))
If D1 happens to be above 140 an error is returned. You can catch that by nesting the above in =IFERROR(<TheAbove>,"No Match") for example.
Reorder the list so the third column is ascending not descending. and change the >=0 to just 0
Then use:
=INDEX('Risk Assessment Matrix '!I24:I28,MATCH(111,'Risk Assessment Matrix '!K24:K28))
Your INDEX/MATCH looks a bit odd. You wouldn't normally have the "1,1," in there.
Try this:
=INDEX('Risk Assessment Matrix '!I24:I28, MATCH(111,'Risk Assessment Matrix '!J24:J28,0))
This should return "High" (assuming your first column in the table is "I".
Two methods shown:
Pay attention to the order.
An alternate option is the use the new XLOOKUP function.
Although it would require changing the minimum value range from 0 to -9999. An out of range value for non-numeric values of 9999 would also need to be added.
It has the advantage of being easier to read compared to INDEX and MATCH.
=XLOOKUP($D2,$B$2:$B$6,$A$2:$A$6,"Not Found",-1)
The formula looks up the value against a single list of minimum values.
The match_mode (last parameter) is set to -1. This means perform an exact match and if nothing is found return the next smaller item.

How to combine: INDEX + MATCH + ?VLOOKUP?

I'm having an issue with INDEX + MATCH combination:
=INDEX(ALL!$C$1:$I$1,MATCH(TRUE,ALL!C2:I2<>0,0))
At the moment the aforementioned formula does this job to an extent, where if it finds <>0 value in a row it will return header from this specific column. The issue is that the ROW (as above C2:I2) needs to be specified.
I need to vlookup values in the column "A" in sheet "ALL" and based on that, look at corresponding rows between C:I and if the value in that specific row is <>0 then return heading value.
So, in green I would need a formula to pick up numbers from "Data Source" headings, based on value 1 or any value <>0. I'm guessing it all leads somehow to some sort of "vlookup" hybrid.
Any ideas how to combine vlookup in it?
Thanks
If there can only be one '1' per row, I was thinking of this
=SUMIF(INDEX(B:E,MATCH(G2,A:A,0),0),">0",$B$1:$E$1)
Otherwise if there can be more than one '1'
=INDEX($B$1:$E$1,MATCH(TRUE,INDEX(B:E,MATCH(G2,A:A,0),0)>0,0))
to match the first value greater than zero, in this case entered as an array formula.
A simple =SUMIF() formula will do, no other convoluted INDEX() and MATCH() nested formulas required.
Let's presume we have a data-table that starts at B2 and end at
F6, like this:
So now, to comprehend the solution, here's the syntax of SUMIF() formula (Function):
=SUMIF( range, criteria, [sum_range] )
So, what we want to do is:
go over the range of C3:F3 (and each other respective row)
the criteria to when to sum, is when this range contains 1
and we want to sum_range (sum up) fixed array of numbers, so $C$2:$F$2
So the result is (for row 3):
=SUMIF(C3:F3,1,$C$2:$F$2)
and we drag the formula down, producing expected result:
PS: I think this illustrates the point very well, as to why it's important to declare not only what your formula is doing but also, what you're trying to as in whole as there often is a better (easier) way to implement something, that you might not have thought of.
In other words, follow the Minimal, Complete and Verifiable Example

Excel - Find first value in a range that is =< 0 and return the date

So im making an excel spreadsheet and I have a scenario in which I am trying to forecast out some values and I need to use a combination of formulas that will help me find the first value that is less than or equal to 0 from the range of values in the row and return the date above. I have included a screen shot of what i am talking about. Any help is greatly appreciated.
It looks like the data in row 3 is sorted descending, so Match() can be used with -1 as the third parameter. With that, though, Match returns the smallest value that is greater than or equal to the lookup value, so, if there is no 0 in the range, the next cell to the LEFT is returned, which is not what you want.
Therefore, the formula must first find the matching value, then test if it is 0 or less, and if not adjust the returned Match value by 1.
This leads to
=IF(INDEX(B3:G3,MATCH(0,B3:G3,-1))<=0,INDEX(B1:G1,MATCH(0,B3:G3,-1)),INDEX(B1:G1,MATCH(0,B3:G3,-1)+1))

Excel offset with if formula

I have been scratching my head trying to work this out, I would be grateful if you can help.
The formula below offsets 3 places when it finds “Earnings for Period”. However if that cell is enter or zero “0”, I want it to offset 4 places. Any suggestions?
=OFFSET(INDEX($C$2:$C$100,MATCH("Earnings for Period",$C$2:$C$100,0),1),0,3)
There's a few things you could do. The easiest, though not very pretty:
=IF(VLOOKUP("Earnings for period",$C$2:$G$100,3,0)=0,VLOOKUP("Earnings for period",$C$2:$G$100,4,0),VLOOKUP("Earnings for period",$C$2:$G$100,3,0))
We enter 3 vlookup statements. The first is used in the comparison of the IF() statement and will return 0 if the result is either blank or 0 (Depending on the format of your data, if there is a zero length text "" you may need to check for that). Depending on the result, we either do a vlookup for the 3rd column or for the 4th column.

Excel: VLOOKUP that returns true or false?

In Excel we have the VLOOKUP function that looks for a value in a column in a table and then returns a value from a given column in that table if it finds something. If it doesn't, it produces an error.
Is there a function that just returns true or false depending on if the value was found in a column or not?
You could wrap your VLOOKUP() in an IFERROR()
Edit: before Excel 2007, use =IF(ISERROR()...)
You still have to wrap it in an ISERROR, but you could use MATCH() instead of VLOOKUP():
Returns the relative position of an
item in an array that matches a
specified value in a specified order.
Use MATCH instead of one of the LOOKUP
functions when you need the position
of an item in a range instead of the
item itself.
Here's a complete example, assuming you're looking for the word "key" in a range of cells:
=IF(ISERROR(MATCH("key",A5:A16,FALSE)),"missing","found")
The FALSE is necessary to force an exact match, otherwise it will look for the closest value.
Just use a COUNTIF ! Much faster to write and calculate than the other suggestions.
EDIT:
Say you cell A1 should be 1 if the value of B1 is found in column C and otherwise it should be 2. How would you do that?
I would say if the value of B1 is found in column C, then A1 will be positive, otherwise it will be 0. Thats easily done with formula: =COUNTIF($C$1:$C$15,B1), which means: count the cells in range C1:C15 which are equal to B1.
You can combine COUNTIF with VLOOKUP and IF, and that's MUCH faster than using 2 lookups + ISNA. IF(COUNTIF(..)>0,LOOKUP(..),"Not found")
A bit of Googling will bring you tons of examples.
We've always used an
if(iserror(vlookup,"n/a",vlookup))
Excel 2007 introduced IfError which allows you to do the vlookup and add output in case of error, but that doesn't help you with 2003...
You can use:
=IF(ISERROR(VLOOKUP(lookup value,table array,column no,FALSE)),"FALSE","TRUE")
ISNA is the best function to use. I just did. I wanted all cells whose value was NOT in an array to conditionally format to a certain color.
=ISNA(VLOOKUP($A2,Sheet1!$A:$D,2,FALSE))

Resources