Forum

Notifications
Clear all

returning multiple "true" values within 1 cell

8 Posts
3 Users
0 Reactions
71 Views
(@chloecane)
Posts: 3
Active Member
Topic starter
 

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!

formula-2.JPGformula-1.JPG

Chloe 

 
Posted : 06/12/2018 6:47 am
(@sunnykow)
Posts: 1417
Noble Member
 

Hi Chloe

Please upload a sample copy of your file.

It will help us understand your needs better.

Sunny

 
Posted : 06/12/2018 10:01 am
(@chloecane)
Posts: 3
Active Member
Topic starter
 

hi there, here you go, let me know if it makes sense!

Thank you 🙂 

 
Posted : 06/12/2018 11:59 am
(@sunnykow)
Posts: 1417
Noble Member
 

Hi Chloe

You will need a macro for this.

See if this helps.

Sunny

 
Posted : 06/12/2018 9:56 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Hi Chloe

This example uses a custom function.

Hope this helps

Sunny

 
Posted : 06/12/2018 11:42 pm
(@chloecane)
Posts: 3
Active Member
Topic starter
 

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 

 
Posted : 07/12/2018 3:20 am
(@debaser)
Posts: 836
Member Moderator
 

If you have a version of Excel that has TEXTJOIN, you could use:

=TEXTJOIN(" ",TRUE,IF(COUNTIF(B7,"*"&COUNTRY&"*"),COUNTRY,""))

 
Posted : 07/12/2018 8:08 am
(@sunnykow)
Posts: 1417
Noble Member
 

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

 
Posted : 07/12/2018 10:47 am
Share: