View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.misc
Earl Kiosterud Earl Kiosterud is offline
external usenet poster
 
Posts: 611
Default Multiple returned values into a single cell

Biff,

No, I can't. Maybe a non-domestic city? And my comment about a comma in a city name was
almost frivolous, I admit. But I guess I leave it up to the OP to decide if it's important.
And someone'll come up with one, sho'nuff. If we've provided for it, then it'll never
happen! :)
--
Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
"T. Valko" wrote in message
...
It'll get confounded if the city has a comma in it.


Never seen a city name with a comma in it. Can you name one? <g

Biff

"Rick Rothstein (MVP - VB)" wrote in message
...
Some comments: The space after the comma could be included in the formula.


The OP doesn't show a space after his commas in the original postings sample output, so I
didn't include any either.

If there are no Yes conditions, it returns an error.


The following formula should take care of that...

=SUBSTITUTE(IF(B2="Yes",B1&",","")&IF(C2="Yes",C1& ",","")&IF(D2="Yes",D1&",","")&IF(E2="Yes",E1&",", ""),",","",(COUNTIF(B2:E2,"=Yes")=0)+COUNTIF(B2:E2 ,"=Yes"))

It'll get confounded if the city has a comma in it.


Yes, that is true... but then a comma would be a poor choice of delimiter for a list of
cities that could contain commas of their own. HOWEVER, not being one to shrink away from
a challenge<g, this formula will produce a comma delimited list where the items being
delineated could possibly contain commas of their own...

=SUBSTITUTE(SUBSTITUTE(IF(B2="Yes",B1&"$","")&IF(C 2="Yes",C1&"$","")&IF(D2="Yes",D1&"$","")&IF(E2="Y es",E1&"$",""),"$","",(COUNTIF(B2:E2,"=Yes")=0)+CO UNTIF(B2:E2,"=Yes")),"$",",")

Rick