Vlookup function doesn't return value - excel

I used this VLookup formula to retrieve value from another sheet Sheet2 which contains a table with two columns NumEchelon, Indice:
=RECHERCHEV("1/1";Sheet2[NumEchelon];Sheet2[Indice];faux)
But it doesn't return any value, when i click on the cell i found just the formula not the value i want to retrieve from the sheet Sheet2.

Looks like you are using french version of Excel, so I will leave it up to you to find the translated commands. The basic problem from what I am gathering is you are looking up "1/1" in the named range NumEchelon. I am going to guess that this named range is 1 column wide. sheet2[Indice] is a separate chunk of data.
Vloopkup is supposed to search for a specified term in a table (usually 2 or more columns wide located to the right of the search column) and return a value in the same row as the found value in a specified column. The columns are numbered left to right with the first column being zero. The false or FAUX at the end tells it you want an exact match.
So without seeing your data I would say make sure that NumEchelon covers both columns of information, and INDICE column is to the right of NumEchelon. Where you have Sheet2 Indice replace with with a numeric value for the column its from the table you made for the vlookup.
So Assuming NumEchelon is A1:A8 and Indice is B1:B8 I would do the following:
Use a new named range "MonTableaux" and define it as sheet2!A1:B8
=VLOOKUP("1/1",MonTableaux,2,0)
Without the named range it would look like
=VLOOKUP("1/1",sheet2!$A$1:$B$8,2,0)
'note the 0 is the same as false
Now you may be using TABLES and I am not all that familiar with table so there may be short cuts. If that is the case someone point it out to me and I will delete my answer.
If your information you want to return in not lined up vertically with the information you are searching for or if the information you want to return is located to the left of what you are searching for you will want to use a combination of INDEX and MATCH. maybe something like this:
=INDEX(sheet2[Indice],match("1/1",sheet2[NumEchelon],0))

If the formula is showing up in the cell, and not a result like #N/A then the cell is likely formatted as Text, change it to General and click in the formula bar and hit enter again to show the formula result instead of the formula text.

Related

How to see if multiple columns match different conditions and return text

I'd like to return a "u" if the cell to the left is in column I on my other tab AND if the cell underneath is in column F on the other tab. How would I go about this please?
So far I have in cell f7: =IFERROR(IF(VLOOKUP(F8,Table!I:I,1,0)<>"","u",0),"")
but I need to also look in Table!F:F to see if the date from the cell underneath is in it.
EXAMPLE
Here is my data in tab 1:
Here is what I'm looking to do in tab 2:
If I understand your question correctly this formula should provide what you are looking for.
=IFERROR(IF(AND(VLOOKUP(F8,Table!I:I,1,0)=F8,VLOOKUP(F9,Table!F:F,1,0)=F9),"u",0),"")
Using the AND() function requires both tests to be TRUE in order for the evaluations to be TRUE. An OR() allows both to be checked but returns TRUE if either is TRUE. So using the AND() checks both conditions and returns "u" in your IF statement only if both are TRUE.
I changed the logical criteria to equals just to be sure the values match.
Hi Becca,
It seems the part that I missed in the first attempt was the across. I think the vlookup is your easiest way to do this, but you may have to rearrange your columns. If you cut the column I:I on the table tab, and highlight column F:F right click and insert cut cells this will line the data up better for the vlookup. Now if you use the below formula you can compare across.
=IFERROR(IF(VLOOKUP(F8,Table!F:G,2,0)=F9,"u",0),"")
What this does is it finds the look up value and returns the value from the other column. Then it compares the returned value to the value in the cell underneath. If they match you get a "u" and if not, you get a "0". If the lookup is an error, you receive a blank.
Ok let's try this. A $ turns a relative reference into an absolute reference. The following looks up the name in column "A" and returns the date in column "B". It then compares that date to the value of row 10 of the current column. If it is drug across columns it will update to that column. If you wish to lock the column and unlock the row simply move the $ to before the "B" for the "B10" reference.
=IFERROR(IF(VLOOKUP($A2,Table!$A:$B,2,FALSE)=B$10,"U",0),"")
[![enter image description here][3]][3]
If you only care that the date is in the list below you could use an HLOOKUP.
=IFERROR(IF(VLOOKUP($A2,Table!$A:$B,2,FALSE)=HLOOKUP($B2,$10:$10,1,FALSE),"U",0),"")
Then you will have to use an index match however, this will not work on Excel 2019 or older. You will most likely need to use Excel 365. It will work best if you are always checking against the same reference (say B10), but you can drag it across.
=IFERROR(IF(INDEX(Table!$B:$B,MATCH($A2&B$10,Table!$A:$A&Table!$B:$B,0))=B$10,"u",0),"")

Excel: How to sum values associated with certain strings in different columns

Excel Example Image
Hi there! My problem is a little hard to describe so I hope the title isn't misleading.
As you can see in the image, there is a column of different 2-letter-strings with associated values in another column next to them. On the right there is another table with all the strings and a column next to it where I want Excel to sum all the values that are associated with that particular string.
So Excel has to basically scan trough the string column on the very left and check for "GE" for example. If it is successful in finding it, it has to refer to the cell in the same row that references the value and then add this value into the cell where it sums all the "GE" values.
I tried some different things already but I wasn't able to find a solution. I hope you can help me! :)
You'll have to use the SUMIF function. Enter it in every cell of column G where you want to see the result. As an example, G3 cell should be:=SUMIF(B3:B12,"GE", D3:D12)EDIT: You could also pick the value from F column to avoid typos in the function, so you can also do it like:=SUMIF(B3:B12,F3, D3:D12)

Excel Performance - INDEX-MATCH combination

I am using excel to create data sets that are used in a vba application later. I am using this formula:
=INDEX(BaseData!$L$2:$L$10000;MATCH(DataSet!D5&DataSet!E5&DataSet!K5;INDEX(B‌​aseData!$B$2:$B$10000&BaseData!$C$2:$C$10000&BaseData!$D$2:$D$10000;0);0))
usually with a range from f.ex.: A2 - A10000, because my data can be differently long and often vary in data selection.
However, this slows my excel extremely down. I switched to manual calculations, but then, when activating automatic again, my excel instance takes extremely long and often crashes.
I also tried to past some data, but when creating a new dataset, I have to pull the formula down again and sometimes through this errors occur in my data set.
Any suggestions what I can do to make the INDEX-MATCH formulas more performant?
I appreciate your replies!
UPDATE
I guess a lot of performance goes away because index-match does not select the exact range, but also counts in blank rows. How to get the exactl range with index match automatically?
As I mention in my comment above, as long as this is a 'regular' formula and not an Array Formula, you may find success simply replacing "A1:A10000" with "A:A". However barring that, you can create a cell which will calculate reference the number of rows of data which you have, and then use that cell to indirectly reference the complete column with data in it.
CALCULATING YOUR DESIRED RANGE
For the following example to work, I assume that: Column A includes an index key in the form of numbers only; Column A includes no numbers in the header and above; and that the index rows are continuous, with no breaks. Start with the following formula:
=COUNT(A:A)
If my assumptions above hold, then this will return the number of data elements in your table. Once we know where this data starts, we can use this COUNT to determine where it ends. Assume your header is in row 2. (I like to include the header so that if you insert a row beneath the header, Excel picks up that you want to include the new row in your formulas).With that in mind, this formula will create the Excel-style reference which finds the last cell in column A which has data in it:
=ADDRESS(ROW(A2)+1+COUNT(A:A),COLUMN(A2),1,1)
Assuming 50 rows of data [which start at row 3, below the header], and all other assumptions above, this formula will return the text result "$A$53".
If you wanted to do the same thing, but instead return the full range in Column A where data exists (from the header to row 53), you could do as follows:
=ADDRESS(ROW(A2),COLUMN(A2),1,1)&":"&ADDRESS(ROW(A2)+1+COUNT(A:A),COLUMN(A2),1,1)
This returns the text string result "$A$2:$A$53", which is a reference to the full index of unique ID values. It will automatically move around as you would generally expect if you insert any rows or columns. Now assume for your INDEX that you want to pull the same data, but for column B, instead. The formula will be exactly the same, except that where I have "COLUMN(A2)" above, replace with "COLUMN(B2)".
REFERENCING YOUR CALCULATED RANGE
So now you have the address of your proper, limited columns - but how do you actually reference those areas in a formula? By using the INDIRECT function. INDIRECT says "Evaluate some specific criteria. It will create a cell reference. Now look at that cell reference." In its simplest form, this could look like this:
=INDIRECT(A1)
Assume that A1 holds the value "B5". Indirect will pick up the value "B5", and instead of displaying "B5", it will go to B5, and pick up the value there. So to use this with the above, wrap the whole thing in the INDIRECT function. Instead of picking up the text string "$A$1:$A$53", it will actually now reference that range properly. Like so:
=INDIRECT(ADDRESS(ROW(A2),COLUMN(A2),1,1)&":"&ADDRESS(ROW(A2)+1+COUNT(A:A),COLUMN(A2),1,1))
USING A NAMED RANGE
But that is a very long formula to have, and you won't want to use it within a specific cell for a simple INDEX/MATCH. Instead of entering these formulas in cells (although you could), I recommend you go to the Formula Ribbon -> Name Manager -> New Name. Call the name for the index of A "ID_COLUMN". Call the name for the index of "B_COLUMN" (or something more specific).
FINAL FORMULA
Now, if you wanted to make an INDEX/MATCH of your table, which automatically grows/shrinks as you change the data, your formula would look like this [this would, for example, pick the row from column B where column A has the number 100]:
=INDEX(ID_COLUMN,MATCH(100, B_COLUMN, 0))

How to get a column which contains a particular data in a row excel

This is probably very easy for experienced user of excel, but I couldn't find a way to do this, so I asking this question.
I have particular range of cells, let's say E5:M5, only one cell of this range will contain 1, other will contain 0. I want to reference, first cell of that column (which contains label). I want to do this by using a formula in another cell. In the end, that another cell should have label name as its value.
I wanted to post image elaborating what I want, but it seems I can't do that.
Anyway, can anyone tell me how this can be done?
I'm going to assume you want to use a formula rather than VBA as it is not recommended for inexperienced Excel users to use VBA. Use this formula to determine the first column out of your set, which has "1" as a value:
=match(1,E5:M5,0)
If by 'label name' you mean you have a header or something (let's assume in row 4), you can use the index function to pull the value from the mirror set of rows above the match function, like so:
=index(E4:M4,match(1,E5:M5,0))

Vlookup referring to table data in a different sheet

I would like to use a VLOOKUP function referring to a data table placed in a different sheet from the one where the VLOOKUP function in written.
Example: in Sheet 1, cell AA3 I would like to insert the VLOOKUP function.
I want the function to check the number in cell M3, find the same number in Sheet 2 range address A2:Q47 first column, and reproduce the value in the 13th column of that table.
I've written this function but it reports #N/A as a result:
=VLOOKUP(M3,Sheet1!$A$2:$Q$47,13,FALSE)
One of the common problems with VLOOKUP is "data mismatch" where #N/A is returned because a numeric lookup value doesn't match a text-formatted value in the VLOOKUP table (or vice versa)
Does either of these versions work?
=VLOOKUP(M3&"",Sheet1!$A$2:$Q$47,13,FALSE)
or
=VLOOKUP(M3+0,Sheet1!$A$2:$Q$47,13,FALSE)
The former converts a numeric lookup value to text (assuming that lookup table 1st column contains numbers formatted as text). The latter does the reverse, changing a text-formatted lookup value to a number.
Depending on which one works (assuming one does) then you may want to permanently change the format of your data so that the standard VLOOKUP will work
I faced this problem and when i started searching the important point i found is, the value u are looking up i.e M3 column should be present in the first column of the table u want to search
https://support.office.com/en-us/article/VLOOKUP-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1
check in lookup_value
Your formula looks fine. Maybe the value you are looking for is not in the first column of the second table?
If the second sheet is in another workbook, you need to add a Workbook reference to your formula:
=VLOOKUP(M3,[Book1]Sheet1!$A$2:$Q$47,13,FALSE)
There might be something wrong with your formula if you are looking from another sheet maybe you have to change Sheet1 to Sheet2 ---> =VLOOKUP(M3,Sheet2!$A$2:$Q$47,13,FALSE) --- Where Sheet2 is your table array
This lookup only features exact matches. If you have an extra space in one of the columns or something similar it will not recognize it.
I have faced similar problem and it was returning #N/A. That means matching data is present but you might having extra space in the M3 column record, that may prevent it from getting exact value. Because you have set last parameter as FALSE, it is looking for "exact match".
This formula is correct: =VLOOKUP(M3,Sheet1!$A$2:$Q$47,13,FALSE)
Copy =VLOOKUP(M3,A$2:Q$47,13,FALSE) to other sheets, then search for ! replace by !$, search for : replace by :$ one time for all sheets

Resources