Lookup for specific text in cell and VLOOKUP if it contains - excel

I have range with IATA codes in $B$2:$B$3591 and destination names with IATA codes in $A$2:$A$3591. I would like to search for IATA code based on values in range $A$2:$A$3591. The problem is that I can't use exact match as exact text can't be entered.
For example if I type Bromma, formula should display BMA. If I type Arlanda, formula should display ARN and etc.
A B
Stavropol, Russia (STW) STW
Stavanger, Norway (SVG) SVG
Stella Maris, Bahamas (SML) SML
Stockholm, Sweden - All airports (STO) STO
Stockholm, Sweden - Arlanda (ARN) ARN
Stockholm, Sweden - Bromma (BMA) BMA
Stornoway, United Kingdom (SYY) SYY
Storuman, Sweden (SQO) SQO
Strasbourg, France - Bus service (XER) XER
Strasbourg, France - Entzheim (SXB) SXB
Stronsay, United Kingdom (SOY) SOY
Stung Treng, Cambodia (TNX) TNX
I have tried =VLOOKUP(E3&"*";$A$2:$B$3591;2;FALSE) so that in E3 I type Bromma but it does not work. However this works for Stavropol for example.

E3$"*"
Will only match the begining of the the text. Add another wild card for the start:
"*"&E3&"*"
To Match on text anywhere in the string.

Related

Partial match in excel, multiple values in match criteria to match against list

I have a list of ID's that have multiple countries in a string.
ID Countries
1 DK, US
2 PL, UK
3 CN, RU, DE
4 SE, FI
5 US, FI, DE
6 DK
Then I have a list I want to check if any country exist in this list.
Country Country Code
Sweden SE
Denmark DK
Finland FI
So for example, DK, US should return TRUE since DK exist in Sheet1 list.
I have tried:
=INDEX(Sheet1!A:A;MATCH("*"&Sheet2!B2&"*";Sheet1!B:B;0))
But this dosn't work since I'm trying to match DK, US against DK or SE.
I would like to avoid using VBA or splitting the countries to separate columns. I think help/dummy columns is totally fine but not optimal
I'd use:
Formula in C2:
=SUMPRODUCT(--(FILTERXML("<t><s>"&SUBSTITUTE(B2,", ","</s><s>")&"</s></t>","//s")=TRANSPOSE(F$2:F$4)))>0
Or:
=SUMPRODUCT(--ISNUMBER(FIND(", "&$F$2:$F$4&", ",", "&B2&", ")))>0
Drag down.

Excel formula for aggregation and filtering

Is it possible to aggregate values on one excel tab and display on another tab?
In addition to that can we also filter on one of the columns as we aggregate?
For example, Sheet1 has 3 columns - (Continent, City, Ignore)
Continent City Ignore
Europe Paris N
Europe London N
Europe Liverpool N
Europe Rome N
Europe Oslo Y
Asia Tokyo N
Asia Osaka N
Asia Dubai N
Asia Bangkok Y
Asia Mumbai N
Africa Cairo Y
I want my Sheet2 to display the number of cities per continent taking into account the "Ignore" flag.
Continent #Cities
Europe 4
Asia 4
Africa 0
Since 3 Cities are marked as Ignore=Y, we don't want to count them.
It came as one of the recommended pivot tables, but I'm trying to build this using excel formulas so I can build on that if needed.
Prefer excel formulas over VBA or Macro.
Using your sample data...
Formula in F2:
=COUNTIFS($A$2:$A$12,E2,$C$2:$C$12,"N")
Drag down...

Spreadsheet : every possible combination of 2 columns into one single colum

and sorry if this question looks familiar, I saw a lot of similar problems but couldn't understand the trick, and I completely stuck.
I have a spreadsheet with 2 columns :
A with Countries
B with their code
A B
Belgium BE
England EN
France FR
Luxembourg LX
Netherlands NL
Spain SP
I'm trying to generate generate a matrix representing all the possible travels : Travel from A to A, from A to B, from B to A, and from B to B. The only restriction is not to travel from a country to itself.
At the end I want to generate the result in a single column C, like this :
Travel from Belgium to England Travel from Belgium to France
Travel from Belgium to Luxembourg Travel from Belgium to
Netherlands Travel from Belgium to Italy Travel from Belgium
to Spain Travel from England to Belgium Travel from England to
France Travel from England to Luxembourg Travel from England
to Netherlands Travel from England to Italy Travel from
England to Spain etc Travel from Belgium to EN Travel from
Belgium to FR Travel from Belgium to LX Travel from Belgium to
NL etc Travel from BE to EN Travel from BE to FR
Travel from BE to LX etc Travel from BE to England Travel
from BE to France etc
Can anyone help me with that ? I tried several tricks with concatenation and JOIN, but I don't get anywhere ...
Thanks a lot in advance
You can run through each value in column A and associate it with a staggered value from column B but you will have to perform some mathematical trickery using the INT function and MOD function to have the sixth entry in column A associated with the first entry in column B.
        
The formulas in C2:E2 are,
=INDEX(A$2:A$7, INT((ROW(1:1)-1)/(COUNTA(A$2:A$7)-1))+1)
=INDEX(B$2:B$7, MOD(MOD((ROW(1:1)-1), (COUNTA(B$2:B$7)-1))+INT((ROW(1:1)-1)/(COUNTA(B$2:B$7)-1))+1, COUNTA(A$2:A$7))+1)
="Travel from "&C2&" to "&D2
There may be a more elegant way of looping through the destinations while skipping the origin but this works and it is not calculation intensive despite the apparent complexity of the formula(s).
I've used the COUNTA function to determine the number of entries rather than hard-code in ordinal numbers. You should be able to transcribe this for more or less entries by following and modifying the referenced cell ranges.

Excel: search two columns against another two columns to return a value fron a third

Got a bit of a pain. So got an interesting issue, basically. Have a long list of entities (200 plus) and I need to match them against a code which I have in another list. So from the entity list, I have the name and country of the entity (Name in column A, country in column D), I need to populate Column F with the code from the other list, or add unknown if a code cant be found.
So, tried to build the query by using the & operator
So =MATCH(A2&D2 to use as key, giving me a value like 'cool companyUNITED KINGDOM'.
In the second list (imported to sheet 2) contains the following columns
Code Name Country
So I want to search an array where Name and country have been combined:
=MATCH(A2&D2,Sheet2!B2:B99999&Sheet2!C2:C99999,0)
I then try to get the index back, so my complete list looks like
=INDEX(Sheet2!A2:C99999, MATCH(Sheet2!A2&Sheet2!D2,Sheet2!B2:B99999&Sheet2!C2:C99999,0))
And all I get back is #Value
Any suggestions
Edit: More infor
So sheet one looks like this (Its column C I need to populate from the code in column A, sheet two)
Entity name Status GIIN Country
Ben Dist Ltd NFFE N/a UNITED KINGDOM
Karamara Sdn Bhd PFFE N/a MALAYSIA
Farbion Trade (Curacao) N.V. LFFI N/a
Tentorim (International) B.V. LFFI N/a NETHERLANDS
Catamo B.V. TLTD N/a NETHERLANDS
Ben Dist Deutschland GmbH FLTD N/a GERMANY
Ben Dist Investments B.V. PFFE N/a NETHERLANDS
Ben Dist Limited TLTD N/a UNITED KINGDOM
Complete Solution Service Limited GLRS N/a UNITED KINGDOM
BDLT S.A. de C.V. TLTD N/a MEXICO
Telsa Telco Services SLTD N/a CHILE
And the second list will look like this
GIIN FINm CountryNm
AAAUG3.99999.SL.764 Asset Plus HSI Fund THAILAND
AABEIL.99999.SL.528 Gresham Capital CLO II B.V. NETHERLANDS
AAB36F.99999.SL.470 Maitland Malta Limited MALTA
AACRQK.99999.SL.756 BBGI GROUP SA SWITZERLAND
AADAD7.99999.SL.528 E-MAC DE 2009-I B.V. NETHERLANDS
AADDBX.99999.SL.060 GWD Limited BERMUDA
AAE9W5.99999.SL.764 Bualuang Money Market RMF THAILAND
AAGH8E.99999.SL.276 Sparda-Bank Baden-Wuerttemberg eG GERMANY
AAGR6U.99999.SL.438 Konsolidationsanstalt LIECHTENSTEIN
AAGWV3.99999.SL.360 BATAVIA PROTEKSI PRIMA 18 INDONESIA
AAGXH0.99999.SL.136 Monarch Capital Partners Ltd CAYMAN ISLANDS
AAHY1V.99999.SL.158 Pingtung County Farmers' Association TAIWAN
AAH0IZ.99999.SL.136 Diversified Absolute Return Fund CAYMAN ISLANDS
I suggest that you use following array formula:
= IFERROR(INDEX(List,SMALL(IF((INDEX(List,,2,1)=A2)*(INDEX(List,,3,1)=D2),ROW(List)-MIN(ROW(List))+1,""),1),1,1),"N/A")
To enter array formula in Windows use Ctrl+Alt+Enter.
On Mac keyboard use Command+Enter.
Then drag the formula downwards.
In this formula I have used named range List, which is equivalent to your Sheet2!$A$2:$C$99999. Named ranges make complicated formulas more readable and flexible.
If you do not want to use named ranges just replace List with Sheet2!$A$2:$C$99999.
=IFERROR(INDEX(Sheet2!$A$2:$C$99999,SMALL(IF((INDEX(Sheet2!$A$2:$C$99999,,2,1)=A2)*(INDEX(Sheet2!$A$2:$C$99999,,3,1)=D2),ROW(Sheet2!$A$2:$C$99999)-MIN(ROW(Sheet2!$A$2:$C$99999))+1,""),1),1,1),"N/A")
It works if your sheets look as follows:

comparing two columns in excel (VLOOKUP not working)

I have been breaking my head with this problem since morning and I haven't found a solution. Please give your valuable pointers if possible, so that I can try to find the solution.
I basically have two sets of data- an old list and a new list. I wish to compare the new list( comparing name and country together) with an old list, since the new list has a few additional entries. Later on, I would like to create a new list with common entries from both old and new list and add all the new entries below the common ones ( if possible, else I will do that manually later on but I would like Excel to tell me that this is a new entry). Sorry, if this has not been well explained, but maybe the following illustration helps
Old List
Item No. Name Country
1 Apples Italy
3 Banana Spain
4 Grapes Slovakia
5 Pineapple Greece
8 Banana Czech Republic
14 Apples India
23 Pineapple Hungary
19 Peach USA
2 Strawberries France
New List
Item No. Name Country
4 Grapes Slovakia
Mango Pakistan
14 Apples India
Oranges Mexico
19 Peach USA
2 Strawberries France
1 Apples Italy
3 Banana Spain
23 Pineapple Hungary
Avocado Netherlands
Expected Output:
List with common serial No.s based on common names from both lists
Item No.Name Country
4 Grapes Slovakia
14 Apples India
19 Peach USA
2 Strawberries France
1 Apples Italy
3 Banana Spain
23 Pineapple Hungary
Mango Pakistan
Oranges Mexico
Avocado Netherlands
As can be seen in this attachment, I have an old list with Item No., Name and Country. Let's assume that the item numbers have been classified based on some code words. In the second list, there are again Item No.s, Name and Country but some item numbers haven't been filled ( since they are new and have not yet been sorted). Now, I want Excel to compare the names AND countries of both data and provide the common Item No. output if there is a match. If there is no match, then I would like Excel to tell me that this is a new entry. I looked up on various forums and I realized that VLOOKUP command only allows me to search on Name OR Country would give me the common entries of Names/Countries respectively but not Item No.s. Is there any formula that could help me solve this problem?
Just paste the list together, then sort it, and then remove the duplicates. Removing duplicates is built-in into Excel starting from version 2007, you will find it in the Data ribbon (see http://office.microsoft.com/en-001/excel-help/filter-for-unique-values-or-remove-duplicate-values-HP010073943.aspx).
To use VLOOKUP just concatenate Name and Country, for example, B2 & "-" & C2. You can then do a lookup on the concatenated values in your source table:
VLOOKUP(B2 & "-" & C2,NewList!D2:E100,2,False)
This assumes that the concatenated column is in D in your new table, and that you've copied the numbers to column E (VLOOKUP can't look to the right). I put in the dash for readablility and to avoid the chance that a Country ends with a number, unlikely as that might be.

Resources