Vlookup Not Working - Excel 2016 [duplicate] - excel

I am working with an excel file and I am trying to "map" some values with the vLookUp function.
The first parameter of the vLookUp function is giving me headaches: The function works with certains values (typed by hand in a text format)...but doesnt work with pre-generated values (the sames ones...but generated from an ERP system..). I checked to make sure that I was looking for "same nature" values ( text vs text ) ...but I can't find out why the first 3 values (typed by hand) are fine... but the last 3 (pre generated) gives me a #N/A error: It has to be a difference of "format" ..but I can't find out where's the difference...
This is the formula used: =VLOOKUP(D1;$A$1:$B$219;2;FALSE)
The actual file
1008600 379.99 1008600 379.99
1008601 379.99 1008601 379.99
1010600 449.99 1010600 449.99
1010601 449.99 1010601 #N/A
1013600 489.99 1013600 #N/A
1014601 509.99 1014601 #N/A
1015600 569.99
1018603 679.99
1019600 809.99
Thank you !

Using this formula will address the issue highlighted by RocketDonkey
=VLOOKUP(TEXT(D1,"#"),$A$1:$B$219,2,FALSE)

The issue is that you haven't converted you values in column A to numbers. Since the first three values in your lookup range are themselves strings, they are matching the stringified numbers.
In order to fix, click on one of the numbers in column A, press Ctrl+Space to select the entire column, and then click on the exclamation mark and select Convert to number:
After that, you'll notice that your previous values now show errors, so follow the same process to conver them to numbers as well. #nutsch's solution is does not require you to modify your data, so if the type of your data is not crucial, that is a good fix as well :)

This has been a major pain for me as well(Excel is full of stupid assumptions). What I do is copy the entire column to a text editor, change the column to match the lookup column, and copy and paste the data back into the column. This has worked well for me.

May I highlight the little noticeable reply that Barry Houdini came with in 2012 above:
=VLOOKUP(D1&"",$A$1:$B$219,2,FALSE)
that really works (for me in Excel 2010), despite you are dealing with Numbers or a mix of Numbers or Text strings.
Cudos to Barry, you are a truely Houdini

Related

COUNTIF formula counts values that don't match

I'm using counting invoice numbers (text) in a table's column, but the Excel formula seems to be confusing some values.
I copied small sample of these - please refer to below:
The formulas are as follow:
=COUNTIFS(A1:A19,A1)
=COUNTIF(A1:A19,A1)
As you can see these invoice numbers differ and the results of these functions suggest as if all were the same.
I googled it for 1 hour but I didn't find such as issue as mine.
If anybody had any clue why could this behave in such way I'll be super grateful!
Rob
Each time you copy down this formula it will add 1 row to each. For example the second row of datas formula will be =COUNTIFS(A2:A20,A2). To lock these cells in the formula use $
Your formula should be =COUNTIFS(A$1:A$19,A1)
I've solved this myself:
ROOTCAUSE
Excel tried to be helpful and read these invoice numbers as actual numbers (despite these being defined already in Power Query as text)
Then, Excel fooled me and despite showing that it works on it as a string (I was evaluating the formula) it worked on it as number
Above means that it transformed exemplary "00100001010000018525" to 1.00001E+17, which cut down this to "100001010000018000" - that's the moment Excel stopped fooling around and showed that value in the formula bar.
I think I don't need to tell why countif perceived all these values as equal.
SOLUTION
I simply appended one letter after each invoice number to get e.g. "00100001010000018525a" what forces Excel to quit its gimmicks and games.
Case closed.
I suspect this is a bug in COUNTIF, or maybe by design.
However, to workaround this in the formula, without having to change your data, try adding a wild-card character:
=COUNTIF(A1:A19,"*"&A1)

Excel - Minimum and If statement - date error

I am trying to write a formula that checks the status and name to be ongoing and joe blogs (in this example), and once finding a match, will identify the oldest date of a ticket raised.
My formula currently includes:
=MIN(IF('Sheet2'!AA:AA="ONGOING",IF('Sheet2'!Q:Q="Joe Bloggs",'Sheet2'!B18:B49)))
I also tried:
=IF((AND(sheet2!$AA:$AA="ongoing", 'Sheet2'!$Q:$Q="Joe Bloggs")), MIN('Sheet2'!B18:B49),"No")
In Column B contains dates. Q contains names, AA contains the status.
At the moment when this runs I get the result '00/01/1990'.
I have done some checks to find the error, and appears to be around the targets name, as when the second formula is tried, the output is "no". The name is definitely in the Q column, and I have completed other formulas including countifs which have worked perfectly fine.
I have done a lot of searching to find nested ifs and min statements to have no joy , would be grateful of any advice / tips. It may be a simple error to some.
Try entering this as an array formula:
=MIN(IF(sheet2!AA:AA="ongoing",IF(sheet2!q:q="Joe Bloggs",sheet2!B:B)))
FYI I found the solution here.
You will have to apply a date format to the result.
Your first formula works well on my data (as below). If I close the formula with ENTER only, I get the result '37128' and if I close the formula with CTRL+SHIFT+ENTER I get the expected result, '25/08/2001'.
Edit: As #FocusWiz said in the comments, the only major difference (other than different column names) between my formula and yours is the the last range in your formula (B18:B49) is a different sized range to the other two, which are referring to full columns.
*This could be solved either by using the same row range for all three column references (AA18:AA49, Q18:Q49, B18:B49) or referencing the full column range for all three ranges (AA:AA,Q:Q,B:B).
This is your formula I'm talking about:
=MIN(IF('Sheet2'!AA:AA="ONGOING",IF('Sheet2'!Q:Q="Joe Bloggs",'Sheet2'!B18:B49)))
And this is the formula in my workbook F7:
=MIN(IF(B:B="ONGOING",IF(A:A="Joe Bloggs",C:C)))
As you can see in the formula editor, squiggly brackets '{}' show around the formula when it has been closed as an array formula.
If that doesn't work for you, please post some sample data with datatypes so we can help figure out what is causing the lookup value to miss the data.
While I like the technique offered by Patrick (I have frequently forgotten an "else" portion of a formula and gotten "false" as a value in a cell but never thought of a use for that...thank you!), I think this question highlights an issue we all can have with array formulas. As girlvsdata indicates, your original formula:
=MIN(IF(Sheet2!AA:AA="ONGOING",IF(Sheet2!Q:Q="Joe Bloggs",Sheet2!B:B)))
(modified above to be more generic for column B) will also work when entered as an array formula.
What likely happened is that somehow the formula got edited and was not re-entered as an array formula.
While I do not dislike array formulas, I do try to avoid them because I have fat fingers and will frequently mess them up by accidentally hitting the wrong key as I am modifying other cells.
Here is an alternative without using an array formula:
=INDEX(LARGE((Sheet2!Q:Q&Sheet2!AA:AA="Joe bloggs"&"ongoing")*(Sheet2!B:B),COUNTIFS(Sheet2!Q:Q,"Joe Bloggs",Sheet2!AA:AA,"ongoing")),1)
What it does is basically create a candidate date value for every row that has "joe bloggs" and "ongoing" which is equal to the date in column B for all such rows. All other rows get a zero candidate date value. The LARGE function takes the smallest nonzero date by counting the n valid candidates with the COUNTIFS function and taking the nth largest such candidate.

VLOOKUP is malfunctioning in Excel?

I have been working on this issue for over two hours and I am beginning to question my sanity. I have used vlookup many times in the past, but now it is just not working as expected. I am trying to replicate a LEFT-JOIN (from SQL) in Excel using vlookup.
Here is the formula I am using on cell G2:
Here is the table of all the values I want to lookup values for.
Here is the table I am using as a reference:
I am only searching one column to simplify the example. Cell G2 contains the formula which is applied to the cells under it as well. As you can see from the first image, not only is it not matching but there is some pretty weird behavior going on.
I have removed duplicates for both tables.
I have unformatted the data to plain text values
I have tried this formula on three different computers
Regardless, I keep kept getting the same result! I am starting to lose sanity.
Does anyone have any idea?
Thank you
If you want exact matches, you should be using FALSE as the last parameter
The lookup table must be sorted in ascending order. Cell A369 appears to have a value lower than the row before it, A368. There are several instances of "lower" values occurring after a higher value.
Before you go insane, consider sorting the range $A$368 thru $A$679, and see if that makes a difference.
Otherwise, time to ditch VLOOKUP, and use instead INDEX and MATCH.
Sometimes you can get the #N/A error if your lookup_value isn't "clean". If that's the case, try this formula:
=VLOOKUP(TRIM(CLEAN(A2)),$A$368:$A$697,1,FALSE)
Additionally, your table_array may have "unclean" data, so you'll need to scrub that first before you're able to find a match. To do that, use this array formula, committing it with Ctrl + Shift + Enter:
=VLOOKUP(A2,TRIM(CLEAN($A$368:$A$697)),1,FALSE)
Have you tried doing a MATCH? does it need to be VLOOKUP?
if you are happy using match try:
=IF(MATCH(A2,$A$368:$A$697,0),A2,"NO MATCH")

Is a cell value in column B in column A? (LibreOffice-Calc)

Column A has a sorted-descending list of some bum's Top-250 movies, in the following format: Apocalypse Now (1979)
Column B has a sorted list of My Top-100, in the same format.
Both lists have been copied and pasted into a Notepad text doc to confirm they are similar simple ASCI text – no extra spaces at the end – etc. - and then pasted back into LibreofficeCalc.
I need a function for Column C that shows any of MY movies (B) that he has NOT listed in (A).
Psudo code:
C1 = The cell value in B1 – is it anywhere in A1:A8000? If not – put B1 value into C1, otherwise leave blank.
C2 = The cell value in B2 – is it anywhere in A1:A8000? If not – put B2 value into C2, otherwise leave blank.
Etc.
I have searched and found these functions – none of which work, for whatever reason. I've modified them to 8000 as the upper range which I don't think I'll ever approach.
=IF(ISERROR(MATCH(B1,$A$1:$A$8000,0))=1,B1,"")
=IFERROR(MATCH(B1;$A$1:$A$8000;0);"")
=IFNA(VLOOKUP($B1;$A$1:$A$8000;1;0);"")
=IF(ISNA(VLOOKUP($B1;$A$1:$A$8000;1;0));"";VLOOKUP($B1;$A$1:$A$8000;1;0))
=IF(ISNA(VLOOKUP($B1,$A$1:$A$8000,1,0)),"",VLOOKUP($B1,$A$1:$A$8000,1,0))
=VLOOKUP(B1,$A$1:$A$8000,1,)
=MATCH($B1;$A$1:$A$999;0)
I'd prefer it to be a single cell function, and not VBA.
I actually solved this back in like 2001 using Excel. The trick then was I had to edit the cell and use Ctrl-Shift-Enter to create a “dynamic array”, so the function was bracketed in {} curly brackets. But now I'm using the latest LibreOffice Calc and can't get the ##$# syntax correct.
Thank you!!
Edit NOTE: testing with "A" and "00001" numbers produces very different results. Values have to look like this in both columns:
Alice (1988)
Barfly (1987)
Clueless (1995)
etc.
OK I've tested these in Open Office with the following results:-
=IF(ISERROR(MATCH(B1,$A$1:$A$8000,0))=1,B1,"")
Gives Error 508 because the commas need changing to semicolons.
**=IF(ISERROR(MATCH(B1;$A$1:$A$8000;0))=1;B1;"")**
is fine.
=IFERROR(MATCH(B1;$A$1:$A$8000;0);"")
Gives #Name? because IFERROR isn't recognised.
=IFNA(VLOOKUP($B1;$A$1:$A$8000;1;0);"")
Gives #Name? because IFNA isn't recognised.
=IF(ISNA(VLOOKUP($B1;$A$1:$A$8000;1;0));"";VLOOKUP($B1;$A$1:$A$8000;1;0))
Works but gives the opposite result.
**=IF(ISNA(VLOOKUP($B1;$A$1:$A$8000;1;0));B1;"")**
would be fine.
=IF(ISNA(VLOOKUP($B1,$A$1:$A$8000,1,0)),"",VLOOKUP($B1,$A$1:$A$8000,1,0))
Commas
=VLOOKUP(B1,$A$1:$A$8000,1,)
Commas
=MATCH($B1;$A$1:$A$999;0)
Works but just gives the position of the match.
Probably the easiest way of doing it is:-
**=IF(COUNTIF(A$1:A$8000;B1);"";B1)**
Unfortunately it does seem that strings with brackets in are giving spurious matches in Libre/Open Office. You could get round it by a substitution I guess
=IF(COUNTIF(SUBSTITUTE(SUBSTITUTE(A$1:A$10;"(";"<");")";">");SUBSTITUTE(SUBSTITUTE(B1;"(";"<");")";">"));"";B1)
entered as an array formula and copied (rather than pulled) down or of course global edit all the brackets :-(.
Now that I know the root cause of this thanks to #Lyrl, there is a further option of turning off the regular expressions as suggested or you could escape the brackets:-
=IF(COUNTIF(A$2:A$11;SUBSTITUTE(SUBSTITUTE(B2;"(";"\(");")";"\)"));"";B2)
See documentation on Regex in Open Office here
This should do it,
=IF(ISNUMBER(MATCH(B1,$A$1:$A$8000,0)),"",B1)
Tested formula
=IF(ISNA(MATCH(B1,$A$1:$A$8000,0))=TRUE(),B1,"")

Combining an IF statement with a SEARCH and subtraction operation

I need to search in a column for the word "complete" and if it doesn't exist then I need to subtract a date in another column from today (TODAY()). I have several fields that do not have any values so I'm also doing a check for NULL fields. This is my formula:
IF(AND(SEARCH(M30,"complete"),O30<>""),"*",O30-TODAY())
(Column M is string of text and column O is a date.)
When I run this formula I'm getting a #VALUE error so I assume something needs to be typecast.
I don't think it will matter for this particular question but I'm using Excel 2013.
When the search term is not found the formula will produce an error. So you have to check for an instance of an error to see if it's found or not.
This formula should work:
=IF(AND(NOT(ISERROR(SEARCH(M30,"complete"))),O30<>""),"*",O30-TODAY())
N.B. - Bear in mind that the Search function as you wrote it may actually be reversed. Depending on your needs, you may need to write it as SEARCH("complete",M30)

Resources