Formula is too long

cocks17

New Member
Joined
Dec 20, 2010
Messages
36
Hi

I have the formula below which aims to search the cell to to find the URL suffix and then attribute the right country for it. As there are around 250 country domains its proven to be a very long formula and excel will not allow this formula with the message "formula is too long". Is there an alternative way of doing this. I need this to work for a column of up to 10000 domains with the country displayed to the right of each URL.

=IF(B7="","",IF(ISNUMBER(SEARCH(".ac",B7)),"AscensionIsland", IF(ISNUMBER(SEARCH(".ad",B7)),"Andorra", IF(ISNUMBER(SEARCH(".ae",B7)),"United Arab Emirates", IF(ISNUMBER(SEARCH(".af",B7)),"Afghanistan", IF(ISNUMBER(SEARCH(".ag",B7)),"Antigua and Barbuda", IF(ISNUMBER(SEARCH(".ai",B7)),"Anguilla", IF(ISNUMBER(SEARCH(".al",B7)),"Albania", IF(ISNUMBER(SEARCH(".am",B7)),"Armenia", IF(ISNUMBER(SEARCH(".an",B7)),"Netherlands Antilles", IF(ISNUMBER(SEARCH(".ao",B7)),"Angola", IF(ISNUMBER(SEARCH(".aq",B7)),"Antarctica", IF(ISNUMBER(SEARCH(".ar",B7)),"Argentina", IF(ISNUMBER(SEARCH(".as",B7)),"American Samoa", IF(ISNUMBER(SEARCH(".at",B7)),"Austria", IF(ISNUMBER(SEARCH(".au",B7)),"Australia", IF(ISNUMBER(SEARCH(".aw",B7)),"Aruba", IF(ISNUMBER(SEARCH(".ax",B7)),"Åland", IF(ISNUMBER(SEARCH(".az",B7)),"Azerbaijan", IF(ISNUMBER(SEARCH(".ba",B7)),"Bosnia and Herzegovina", IF(ISNUMBER(SEARCH(".bb",B7)),"Barbados", IF(ISNUMBER(SEARCH(".bd",B7)),"Bangladesh", IF(ISNUMBER(SEARCH(".be",B7)),"Belgium", IF(ISNUMBER(SEARCH(".bf",B7)),"Burkina Faso", IF(ISNUMBER(SEARCH(".bg",B7)),"Bulgaria", IF(ISNUMBER(SEARCH(".bh",B7)),"Bahrain", IF(ISNUMBER(SEARCH(".bi",B7)),"Burundi", IF(ISNUMBER(SEARCH(".bj",B7)),"Benin", IF(ISNUMBER(SEARCH(".bm",B7)),"Bermuda", IF(ISNUMBER(SEARCH(".bn",B7)),"Brunei", IF(ISNUMBER(SEARCH(".bo",B7)),"Bolivia", IF(ISNUMBER(SEARCH(".br",B7)),"Brazil", IF(ISNUMBER(SEARCH(".bs",B7)),"Bahamas", IF(ISNUMBER(SEARCH(".bt",B7)),"Bhutan", IF(ISNUMBER(SEARCH(".bv",B7)),"Bouvet Island", IF(ISNUMBER(SEARCH(".bw",B7)),"Botswana", IF(ISNUMBER(SEARCH(".by",B7)),"Belarus", IF(ISNUMBER(SEARCH(".bz",B7)),"Belize", IF(ISNUMBER(SEARCH(".ca",B7)),"Canada", IF(ISNUMBER(SEARCH(".cc",B7)),"Cocos(Keeling) Islands", IF(ISNUMBER(SEARCH(".cd",B7)),"Democratic Republic of the Congo", IF(ISNUMBER(SEARCH(".cf",B7)),"Central African Republic", IF(ISNUMBER(SEARCH(".cg",B7)),"Republic of the Congo", IF(ISNUMBER(SEARCH(".ch",B7)),"Switzerland", IF(ISNUMBER(SEARCH(".ci",B7)),"Côted'Ivoire", IF(ISNUMBER(SEARCH(".ck",B7)),"Cook Islands", IF(ISNUMBER(SEARCH(".cl",B7)),"Chile", IF(ISNUMBER(SEARCH(".cm",B7)),"Cameroon", IF(ISNUMBER(SEARCH(".cn",B7)),"People's Republic of China", IF(ISNUMBER(SEARCH(".co",B7)),"Colombia", IF(ISNUMBER(SEARCH(".cr",B7)),"Costa Rica", IF(ISNUMBER(SEARCH(".cs",B7)),"Czechoslovakia", IF(ISNUMBER(SEARCH(".cu",B7)),"Cuba", IF(ISNUMBER(SEARCH(".cv",B7)),"Cape Verde", IF(ISNUMBER(SEARCH(".cx",B7)),"Christmas Island", IF(ISNUMBER(SEARCH(".cy",B7)),"Cyprus", IF(ISNUMBER(SEARCH(".cz",B7)),"Czech Republic", IF(ISNUMBER(SEARCH(".dd",B7)),"East Germany", IF(ISNUMBER(SEARCH(".de",B7)),"Germany", IF(ISNUMBER(SEARCH(".dj",B7)),"Djibouti", IF(ISNUMBER(SEARCH(".dk",B7)),"Denmark", IF(ISNUMBER(SEARCH(".dm",B7)),"Dominica", IF(ISNUMBER(SEARCH(".do",B7)),"Dominican Republic", IF(ISNUMBER(SEARCH(".dz",B7)),"Algeria", IF(ISNUMBER(SEARCH(".ec",B7)),"Ecuador", IF(ISNUMBER(SEARCH(".ee",B7)),"Estonia", IF(ISNUMBER(SEARCH(".eg",B7)),"Egypt", IF(ISNUMBER(SEARCH(".eh",B7)),"Western Sahara", IF(ISNUMBER(SEARCH(".er",B7)),"Eritrea", IF(ISNUMBER(SEARCH(".es",B7)),"Spain", IF(ISNUMBER(SEARCH(".et",B7)),"Ethiopia", IF(ISNUMBER(SEARCH(".eu",B7)),"EuropeanUnion", IF(ISNUMBER(SEARCH(".fi",B7)),"Finland", IF(ISNUMBER(SEARCH(".fj",B7)),"Fiji", IF(ISNUMBER(SEARCH(".fk",B7)),"Falkland Islands", IF(ISNUMBER(SEARCH(".fm",B7)),"Federated States of Micronesia", IF(ISNUMBER(SEARCH(".fo",B7)),"Faroe Islands", IF(ISNUMBER(SEARCH(".fr",B7)),"France", IF(ISNUMBER(SEARCH(".ga",B7)),"Gabon", IF(ISNUMBER(SEARCH(".gb",B7)),"United Kingdom", IF(ISNUMBER(SEARCH(".gd",B7)),"Grenada", IF(ISNUMBER(SEARCH(".ge",B7)),"Georgia", IF(ISNUMBER(SEARCH(".gf",B7)),"French Guiana", IF(ISNUMBER(SEARCH(".gg",B7)),"Guernsey", IF(ISNUMBER(SEARCH(".gh",B7)),"Ghana", IF(ISNUMBER(SEARCH(".gi",B7)),"Gibraltar", IF(ISNUMBER(SEARCH(".gl",B7)),"Greenland", IF(ISNUMBER(SEARCH(".gm",B7)),"The Gambia", IF(ISNUMBER(SEARCH(".gn",B7)),"Guinea", IF(ISNUMBER(SEARCH(".gp",B7)),"Guadeloupe", IF(ISNUMBER(SEARCH(".gq",B7)),"Equatorial Guinea", IF(ISNUMBER(SEARCH(".gr",B7)),"Greece", IF(ISNUMBER(SEARCH(".gs",B7)),"South Georgia and the South Sandwich Islands", IF(ISNUMBER(SEARCH(".gt",B7)),"Guatemala", IF(ISNUMBER(SEARCH(".gu",B7)),"Guam", IF(ISNUMBER(SEARCH(".gw",B7)),"Guinea-Bissau", IF(ISNUMBER(SEARCH(".gy",B7)),"Guyana", IF(ISNUMBER(SEARCH(".hk",B7)),"Hong Kong", IF(ISNUMBER(SEARCH(".hm",B7)),"Heard Islandand McDonald Islands", IF(ISNUMBER(SEARCH(".hn",B7)),"Honduras", IF(ISNUMBER(SEARCH(".hr",B7)),"Croatia", IF(ISNUMBER(SEARCH(".ht",B7)),"Haiti", IF(ISNUMBER(SEARCH(".hu",B7)),"Hungary", IF(ISNUMBER(SEARCH(".id",B7)),"Indonesia", IF(ISNUMBER(SEARCH(".ie",B7)),"Republic of Ireland", IF(ISNUMBER(SEARCH(".il",B7)),"Israel", IF(ISNUMBER(SEARCH(".im",B7)),"Isle of Man", IF(ISNUMBER(SEARCH(".in",B7)),"India", IF(ISNUMBER(SEARCH(".io",B7)),"British Indian Ocean Territory", IF(ISNUMBER(SEARCH(".iq",B7)),"Iraq", IF(ISNUMBER(SEARCH(".ir",B7)),"Iran", IF(ISNUMBER(SEARCH(".is",B7)),"Iceland", IF(ISNUMBER(SEARCH(".it",B7)),"Italy", IF(ISNUMBER(SEARCH(".je",B7)),"Jersey", IF(ISNUMBER(SEARCH(".jm",B7)),"Jamaica", IF(ISNUMBER(SEARCH(".jo",B7)),"Jordan", IF(ISNUMBER(SEARCH(".jp",B7)),"Japan", IF(ISNUMBER(SEARCH(".ke",B7)),"Kenya", IF(ISNUMBER(SEARCH(".kg",B7)),"Kyrgyzstan", IF(ISNUMBER(SEARCH(".kh",B7)),"Cambodia", IF(ISNUMBER(SEARCH(".ki",B7)),"Kiribati", IF(ISNUMBER(SEARCH(".km",B7)),"Comoros", IF(ISNUMBER(SEARCH(".kn",B7)),"Saint Kitts and Nevis", IF(ISNUMBER(SEARCH(".kp",B7)),"Democratic People's Republic of Korea", IF(ISNUMBER(SEARCH(".kr",B7)),"Republic of Korea", IF(ISNUMBER(SEARCH(".kw",B7)),"Kuwait", IF(ISNUMBER(SEARCH(".ky",B7)),"Cayman Islands", IF(ISNUMBER(SEARCH(".kz",B7)),"Kazakhstan", IF(ISNUMBER(SEARCH(".la",B7)),"Laos", IF(ISNUMBER(SEARCH(".lb",B7)),"Lebanon", IF(ISNUMBER(SEARCH(".lc",B7)),"SaintLucia", IF(ISNUMBER(SEARCH(".li",B7)),"Liechtenstein", IF(ISNUMBER(SEARCH(".lk",B7)),"SriLanka", IF(ISNUMBER(SEARCH(".lr",B7)),"Liberia", IF(ISNUMBER(SEARCH(".ls",B7)),"Lesotho", IF(ISNUMBER(SEARCH(".lt",B7)),"Lithuania", IF(ISNUMBER(SEARCH(".lu",B7)),"Luxembourg", IF(ISNUMBER(SEARCH(".lv",B7)),"Latvia", IF(ISNUMBER(SEARCH(".ly",B7)),"Libya", IF(ISNUMBER(SEARCH(".ma",B7)),"Morocco", IF(ISNUMBER(SEARCH(".mc",B7)),"Monaco", IF(ISNUMBER(SEARCH(".md",B7)),"Moldova", IF(ISNUMBER(SEARCH(".me",B7)),"Montenegro", IF(ISNUMBER(SEARCH(".mg",B7)),"Madagascar", IF(ISNUMBER(SEARCH(".mh",B7)),"Marshall Islands", IF(ISNUMBER(SEARCH(".mk",B7)),"Macedonia", IF(ISNUMBER(SEARCH(".ml",B7)),"Mali", IF(ISNUMBER(SEARCH(".mm",B7)),"Myanmar", IF(ISNUMBER(SEARCH(".mn",B7)),"Mongolia", IF(ISNUMBER(SEARCH(".mo",B7)),"Macau", IF(ISNUMBER(SEARCH(".mp",B7)),"Northern Mariana Islands", IF(ISNUMBER(SEARCH(".mq",B7)),"Martinique", IF(ISNUMBER(SEARCH(".mr",B7)),"Mauritania", IF(ISNUMBER(SEARCH(".ms",B7)),"Montserrat", IF(ISNUMBER(SEARCH(".mt",B7)),"Malta", IF(ISNUMBER(SEARCH(".mu",B7)),"Mauritius", IF(ISNUMBER(SEARCH(".mv",B7)),"Maldives", IF(ISNUMBER(SEARCH(".mw",B7)),"Malawi", IF(ISNUMBER(SEARCH(".mx",B7)),"Mexico", IF(ISNUMBER(SEARCH(".my",B7)),"Malaysia", IF(ISNUMBER(SEARCH(".mz",B7)),"Mozambique", IF(ISNUMBER(SEARCH(".na",B7)),"Namibia", IF(ISNUMBER(SEARCH(".nc",B7)),"New Caledonia", IF(ISNUMBER(SEARCH(".ne",B7)),"Niger", IF(ISNUMBER(SEARCH(".nf",B7)),"Norfolk Island", IF(ISNUMBER(SEARCH(".ng",B7)),"Nigeria", IF(ISNUMBER(SEARCH(".ni",B7)),"Nicaragua", IF(ISNUMBER(SEARCH(".nl",B7)),"Netherlands", IF(ISNUMBER(SEARCH(".no",B7)),"Norway", IF(ISNUMBER(SEARCH(".np",B7)),"Nepal", IF(ISNUMBER(SEARCH(".nr",B7)),"Nauru", IF(ISNUMBER(SEARCH(".nu",B7)),"Niue", IF(ISNUMBER(SEARCH(".nz",B7)),"New Zealand", IF(ISNUMBER(SEARCH(".om",B7)),"Oman", IF(ISNUMBER(SEARCH(".pa",B7)),"Panama", IF(ISNUMBER(SEARCH(".pe",B7)),"Peru", IF(ISNUMBER(SEARCH(".pf",B7)),"French Polynesia", IF(ISNUMBER(SEARCH(".pg",B7)),"Papua New Guinea", IF(ISNUMBER(SEARCH(".ph",B7)),"Philippines", IF(ISNUMBER(SEARCH(".pk",B7)),"Pakistan", IF(ISNUMBER(SEARCH(".pl",B7)),"Poland", IF(ISNUMBER(SEARCH(".pm",B7)),"Saint-Pierre and Miquelon", IF(ISNUMBER(SEARCH(".pn",B7)),"Pitcairn Islands", IF(ISNUMBER(SEARCH(".pr",B7)),"Puerto Rico", IF(ISNUMBER(SEARCH(".ps",B7)),"Palestinian territories", IF(ISNUMBER(SEARCH(".pt",B7)),"Portugal", IF(ISNUMBER(SEARCH(".pw",B7)),"Palau", IF(ISNUMBER(SEARCH(".py",B7)),"Paraguay", IF(ISNUMBER(SEARCH(".qa",B7)),"Qatar", IF(ISNUMBER(SEARCH(".re",B7)),"Réunion", IF(ISNUMBER(SEARCH(".ro",B7)),"Romania", IF(ISNUMBER(SEARCH(".rs",B7)),"Serbia", IF(ISNUMBER(SEARCH(".ru",B7)),"Russia", IF(ISNUMBER(SEARCH(".rw",B7)),"Rwanda", IF(ISNUMBER(SEARCH(".sa",B7)),"Saudi Arabia", IF(ISNUMBER(SEARCH(".sb",B7)),"Solomon Islands", IF(ISNUMBER(SEARCH(".sc",B7)),"Seychelles", IF(ISNUMBER(SEARCH(".sd",B7)),"Sudan", IF(ISNUMBER(SEARCH(".se",B7)),"Sweden", IF(ISNUMBER(SEARCH(".sg",B7)),"Singapore", IF(ISNUMBER(SEARCH(".sh",B7)),"Saint Helena", IF(ISNUMBER(SEARCH(".si",B7)),"Slovenia", IF(ISNUMBER(SEARCH(".sj",B7)),"Svalbard and Jan Mayen Islands", IF(ISNUMBER(SEARCH(".sk",B7)),"Slovakia", IF(ISNUMBER(SEARCH(".sl",B7)),"Sierra Leone", IF(ISNUMBER(SEARCH(".sm",B7)),"San Marino", IF(ISNUMBER(SEARCH(".sn",B7)),"Senegal", IF(ISNUMBER(SEARCH(".so",B7)),"Somalia", IF(ISNUMBER(SEARCH(".sr",B7)),"Suriname", IF(ISNUMBER(SEARCH(".ss",B7)),"South Sudan", IF(ISNUMBER(SEARCH(".st",B7)),"São Tomé and Príncipe", IF(ISNUMBER(SEARCH(".su",B7)),"Soviet Union", IF(ISNUMBER(SEARCH(".sv",B7)),"El Salvador", IF(ISNUMBER(SEARCH(".sy",B7)),"Syria", IF(ISNUMBER(SEARCH(".sz",B7)),"Swaziland", IF(ISNUMBER(SEARCH(".tc",B7)),"Turks and Caicos Islands", IF(ISNUMBER(SEARCH(".td",B7)),"Chad", IF(ISNUMBER(SEARCH(".tf",B7)),"French Southern and Antarctic Lands", IF(ISNUMBER(SEARCH(".tg",B7)),"Togo", IF(ISNUMBER(SEARCH(".th",B7)),"Thailand", IF(ISNUMBER(SEARCH(".tj",B7)),"Tajikistan", IF(ISNUMBER(SEARCH(".tk",B7)),"Tokelau", IF(ISNUMBER(SEARCH(".tl",B7)),"East Timor", IF(ISNUMBER(SEARCH(".tm",B7)),"Turkmenistan", IF(ISNUMBER(SEARCH(".tn",B7)),"Tunisia", IF(ISNUMBER(SEARCH(".to",B7)),"Tonga", IF(ISNUMBER(SEARCH(".tp",B7)),"East Timor", IF(ISNUMBER(SEARCH(".tr",B7)),"Turkey", IF(ISNUMBER(SEARCH(".tt",B7)),"Trinidad and Tobago", IF(ISNUMBER(SEARCH(".tv",B7)),"Tuvalu", IF(ISNUMBER(SEARCH(".tw",B7)),"Taiwan", IF(ISNUMBER(SEARCH(".tz",B7)),"Tanzania", IF(ISNUMBER(SEARCH(".ua",B7)),"Ukraine", IF(ISNUMBER(SEARCH(".ug",B7)),"Uganda", IF(ISNUMBER(SEARCH(".uk",B7)),"UnitedKingdom", IF(ISNUMBER(SEARCH(".us",B7)),"United States of America", IF(ISNUMBER(SEARCH(".uy",B7)),"Uruguay", IF(ISNUMBER(SEARCH(".uz",B7)),"Uzbekistan", IF(ISNUMBER(SEARCH(".va",B7)),"Vatican City", IF(ISNUMBER(SEARCH(".vc",B7)),"Saint Vincent and the Grenadines", IF(ISNUMBER(SEARCH(".ve",B7)),"Venezuela", IF(ISNUMBER(SEARCH(".vg",B7)),"British Virgin Islands", IF(ISNUMBER(SEARCH(".vi",B7)),"United States Virgin Islands", IF(ISNUMBER(SEARCH(".vn",B7)),"Vietnam", IF(ISNUMBER(SEARCH(".vu",B7)),"Vanuatu", IF(ISNUMBER(SEARCH(".wf",B7)),"Wallis and Futuna", IF(ISNUMBER(SEARCH(".ws",B7)),"Samoa", IF(ISNUMBER(SEARCH(".ye",B7)),"Yemen", IF(ISNUMBER(SEARCH(".yt",B7)),"Mayotte", IF(ISNUMBER(SEARCH(".yu",B7)),"Yugoslavia", IF(ISNUMBER(SEARCH(".za",B7)),"South Africa", IF(ISNUMBER(SEARCH(".zm",B7)),"Zambia", IF(ISNUMBER(SEARCH(".zw",B7)),"Zimbabwe","UNKNOWN")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi

One possibility - have a table set up to hold your extensions and the relevant country, then use the lookup formula.

You should include the preceding "." in the extension.


Excel 2007
ABCDEFGH
1ExtensionCountryURLCountry
2.coColumnbiawww.nowhere.co.ukUnited Kingdom
3.ukUnited Kingdomwww.elsewhere.co.frFrance
4.frFrance
5.deGermany
Sheet1
Cell Formulas
RangeFormula
G2=LOOKUP(2^15,SEARCH($A$2:$A$5&"/",F2&"/"),$B$2:$B$5)
 
Upvote 0
Hi

One possibility - have a table set up to hold your extensions and the relevant country, then use the lookup formula.

You should include the preceding "." in the extension.


Excel 2007
ABCDEFGH
1ExtensionCountryURLCountry
2.coColumnbiawww.nowhere.co.ukUnited Kingdom
3.ukUnited Kingdomwww.elsewhere.co.frFrance
4.frFrance
5.deGermany
Sheet1
Cell Formulas
RangeFormula
G2=LOOKUP(2^15,SEARCH($A$2:$A$5&"/",F2&"/"),$B$2:$B$5)



Thanks. I understand most of this formula apart from "2^15" what is this reffering too?

I have 252 countries. With the header (extension, country) my columns are 254 rows long. I've changed the formula to:

=LOOKUP(2^200,SEARCH($A$2:$A$253&"/",F2&"/"),$B$2:$B$253)

but im getting and error when I write test.co.uk in cell F2?
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top