Hi Guys,
I've successfully run the following formula;
=INDEX(COUNTRY,IF(SUMPRODUCT(ISNUMBER(SEARCH(COUNTRY,$Q10))*ROW('ALL DATA REFS'!$G$1:$G$216))0,SUMPRODUCT(ISNUMBER(SEARCH(COUNTRY,$Q10))*ROW('ALL DATA REFS'!$G$1:$G$216)),NA()))
I have a named list called "country" which contains all the country names I need, the formula then looks within my selected cell (Q10) and returns the matching country name in another cell - in the 1st attached image you can see it's returning Iceland - which is correct!
In some circumstances there will be 2 or more countries listed in the cell, which using the above formula returns a #REF! (you can see in the second attached image) I assume because it has 2 results in the one cell. Is there any way to return both of those? If so how? Would it have to be done with an Array formula?
If you could help me out I would massively appreciate it.
Thank you!
Chloe
Hi Chloe
Please upload a sample copy of your file.
It will help us understand your needs better.
Sunny
hi there, here you go, let me know if it makes sense!
Thank you 🙂
Hi Chloe
You will need a macro for this.
See if this helps.
Sunny
Hi Chloe
This example uses a custom function.
Hope this helps
Sunny
Hi Sunny,
Firstly thank you for getting back to me I really appreciate it! So if I understand you correctly, in the attachment you've created a custom function called "findcountry"? is that by using a Macro? Apologies I dont know a lot about macros or making custom functions :s Just want to understand what you've done here 🙂
thank you
Chloe
If you have a version of Excel that has TEXTJOIN, you could use:
=TEXTJOIN(" ",TRUE,IF(COUNTIF(B7,"*"&COUNTRY&"*"),COUNTRY,""))
Hi Chloe
Thanks for your feedback.
I used VBA (Visual Basic For Application), a programming language, to write both the macro and function..
I am unable to describe in detail here about VBA but you can search the Internet (or even in MOTH's blog) for it.
Regards
Sunny