How to use vlookup? - excel-formula

How to use Vlookup if the data that we want to match (col_index_num) contains a formula?
I want to match the vendor name to get the addresses. But the addresses contain Proper formula because I changed the address from all UPPERCASE to Proper. I thought that might be the problem why I get #N/A result.

For vlookup , make sure the field that you are trying to look up and the source table in which you are looking up the field are in same format (Vendor name. vlooking up numbers with text format creates error most of the time)
Also, there might be possibility hat there is really no match of the values that you are looking up . (may contain space)

Related

Problems with Excel function SUM.IF

I want to sum a column of an Excel tab (depending on the content of another column) which can have different names.
Therefore I dynamically build the name of the tab and then use it in the SUMIF-function.
However, I get #REFERENCE! error and I don't know why?! I can reference single cells this way but not a range which I have to in this case. Can someone see what I'm doing wrong or maybe help me with a workaround?
=SUMIF(INDIRECT(CHAR(39)&Settings!$D$3&"-V"&L$7&CHAR(39)&"!B3:B100";FALSE);B44;INDIRECT(CHAR(39)&Settings!$D$3&"-V"&L$7&CHAR(39)&"!H3:H100";FALSE))
Area to sum as you can see below:-
Cell where I want the sum to be:-
=SUMIF(INDIRECT("'"&YEAR($E$5)&"-V"&L$7&"'!$M$3:$M$10"),"*"&$C9,INDIRECT("'"&YEAR($E$5)&"-V"&L$7&"'!$O$3:$O$10"))
This is the correct use (note I have used the actual character ' instead of CHAR(39))
The wildcard is used to match anything before the cells content as your data contains PL before it and also note the use of absolute referencing.
You will need to change the , to ; to match your regional settings...

Display value if text strings from two ranges match

I have two worksheets in Excel. One contains the rankings:
:
The other one the matchups (daily updated automatically)
The purpose is to display the rank of each respective team in two columns next to the matchups. One of the problems is that the text strings are not exact matches (limitation of the webquery).
So I need to find a formula for when there is a string of the table in Rankings that approximately matches the specified cell for the team in matchups and then display Rank (column 1 on Rankings) next to it.
So far I've got this in the cell where the ranking is supposed to go.
=VLOOKUP("*"&qry!B5&"*";Sheet1!A3:C369;1;0)
But it just results in the string "rank" from the table header in Rankings.
Any ideas?
Several things:
Vlookup will try to find a match in the first column of the lookup table and can return a value from a column to the right. Your lookup table has the desired return value in the first column and the lookup values in the second column. Therefore, Vlookup will not work in this scenario. You can use a combination of Index and Match, though.
the * wildcard before and after the lookup value mean that the value in the lookup table can have any text before and after the text already in your lookup value. In your case, the lookup value has more text than the text in the lookup table. So the wildcard is not helping. Example: you have "353 Virginia" and you want to find this in a column that has only "Virginia". Wrapping "353 Virginia" in wildcards will add no value, because the text that you want to match is actually shorter than the text you are starting out with. You need to remove stuff from the lookup value instead of adding wild cards.
If the data for the rankings comes from a web query, you need to do some work to clean up that data, so it is fit for the lookup into your other table.
In addition to the number at the beginning, there are also two characters at the end of some cells that I cannot identify. These need to be stripped out, too, before you can do the lookup.
Assuming that all cells contain three digits and a space at the beginning you can use a formula approach
=TRIM(MID(SUBSTITUTE(B5;" ##";"");5;99))
Substitute will remove the trailing characters. I don't know what they are exactly, some web related special characters, so for the exercise here I have used ## instead of the A thing and the chevron. Copy and paste the web characters from one of your cells to the formula. With data coming from the web you may also want to check for leading and trailing white space, non-breaking space characters and other invisible characters.
You can use the "cleansing" formula as the basis of a lookup or, if the formula above sufficiently cleans the data, then you can use it in an index/match combo like this:
=index(Sheet1!$A$3:$A$369,match(TRIM(MID(SUBSTITUTE(B5;" ##";"");5;99));Sheet1!$B$3:$B$369;0))
Without seeing the actual data in a spreadsheet it is hard to tell if the formula cleanup is sufficient. You may need to do more work until a lookup returns the desired value.
If the data is coming from the web, I strongly suggest that you look into Power Query as a tool to get the data from the web into your spreadsheet. Power Query is a free add-in for Excel 2010 and 2013 and is built into Excl 2016 as "Get & Transform". It can connect to many data sources, including tables on a web page, and it has very powerful mechanisms to clean data for further processing. Once a Power Query is set up and working, all you need to do is refresh the query to load new data from the web site.

Looking for an Excel formula combining VLOOKUP and SEARCH functions

I have a spreadsheet I am using for real estate where I want to be able to populate the name of a building based on an apartment's address. I need to create a formula that searches for certain information on a cell (probably the building number) and, based on that, looks at a table with building numbers and corresponding names and returns the appropriate value. I can't use a simple VLOOKUP based on the full address because, since they all contain apartment numbers, every address is unique.
I though about combining the search function with LOOKUP but that is not working for me so far.
Any thoughts on how to accomplish this?
Please try:
=VLOOKUP(VALUE(LEFT(D4,FIND(" ",D4)-1)),W:X,2,0)
copied down to suit.
Good point spotted by #Jerry:
=VLOOKUP(VALUE(LEFT(TRIM(D8),FIND(" ",D8,2)-1)),W:X,2,0)
(though any leading space is not necessarily going to be removed by TRIM).

IP address field validation

I'm trying to validate an IP address column in SharePoint 2010 with the following formula. I get an error telling me there's a syntax error without anymore details. Knowing it works in Excel; any idea what's wrong with this formula?
=AND((LEN(Address)-LEN(SUBSTITUTE(Address;".";"")))=3;ISNUMBER(SUBSTITUTE(SUBSTITUTE(Address;":";"");".";"")+0))
Here's a working formula for SharePoint 2013 Online, where IP is the name of the column containing the IP address. Note that there are 40 references to the column name, if you use a long column name to could reach the character limit on validation formulas (I originally had IP Address, which was 320 characters longer, also why I used FIND instead of SEARCH)
=IF(AND(AND(VALUE(LEFT([IP],FIND(".",[IP])))>=0,VALUE(LEFT([IP],FIND(".",[IP])))<256),AND(VALUE(MID([IP],FIND(".",[IP])+1,FIND(".",[IP],FIND(".",[IP])+1)-FIND(".",[IP])))>=0,VALUE(MID([IP],FIND(".",[IP])+1,FIND(".",[IP],FIND(".",[IP])+1)-FIND(".",[IP])))<256),AND(VALUE(MID([IP],FIND(".",[IP],FIND(".",[IP])+1)+1,FIND(".",[IP],FIND(".",[IP],FIND(".",[IP])+1)+1)-FIND(".",[IP],FIND(".",[IP])+1)))>=0,VALUE(MID([IP],FIND(".",[IP],FIND(".",[IP])+1)+1,FIND(".",[IP],FIND(".",[IP],FIND(".",[IP])+1)+1)-FIND(".",[IP],FIND(".",[IP])+1)))<256),AND(VALUE(RIGHT([IP],LEN([IP])-FIND(".",[IP],FIND(".",[IP],FIND(".",[IP])+1)+1)))>=0,VALUE(RIGHT([IP],LEN([IP])-FIND(".",[IP],FIND(".",[IP],FIND(".",[IP])+1)+1)))<256)),TRUE,FALSE)
The answer reside in the fact that there are multiple limitations to SharePoint field validation by formula. Although it uses the same syntax as Excel, its far from being as versatile as Excel is. Here's the well hidden reference that list available functions for field validation.
The problem in the previous question is that SUBSTITUTE() and ISNUMBER() aren't available.
A proper way to validate an IP address would be using a combination of FIND() and MID() instead.
The ISNUMBER function works, it is even mentioned in your link:
To check if a column value or a part of it matches specific text, use the IF, FIND, SEARCH, and ISNUMBER functions.
I did need to add +0 after my column name as mentioned here.
Edit:
After further testing I have discovered that this solution allows for entries with spaces in so it is not ideal.

Why does Excel MATCH() not find a match?

I have a table with some numbers stored as text (UPC codes, so I don't want to lose leading zeros). COUNTIF() recognizes matches just fine, but MATCH() doesn't work. Is there a reason why MATCH() can't handle numbers stored as text, or is this just a limitation I'll have to work around?
Functions like MATCH, VLOOKUP and HLOOKUP need to match data type (number or text) whereas COUNTIF/SUMIF make no distinction. Are you using MATCH to find the position or just to establish whether the value exists in your data?
If you have a numeric lookup value you can convert to text in the formula by using &"", e.g.
=MATCH(A1&"",B:B,0)
....or if it's a text lookup value which needs to match with numbers
=MATCH(A1+0,B:B,0)
If you are looking for the word test for example in cell A2, type the following:
=MATCH(""&"test"&"",A2,0)
If this isn't working then try =Trim and =Clean to purify your column.
If =Trim and =Clean don't help, then just use the left 250 characters...
(As the Match Formula may encounter a timeout/overflow after 250 characters.)
=Left(A2, 250)
If you are using names to refer to the ranges, once you have fixed the datatypes also redefine any names which refer to those ranges.

Resources