Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Creating a long string of text...

Hi there,

I'm trying to figure out a better way to do this - since the formula is
already too long for the cell (and I don't want to split it between two
cells, I want to find a better, more automatic way.

So this is my formula (same thing repeated with more cells)

=IF(BK$6="DE",($B$6 & ", "),"")&(IF(BK$7="DE",$B$7 & ",
",""))&(IF(BK$8="DE",$B$8 & ", ",""))&(IF(BK$9="DE",$B$9 & ",
",""))&(IF(BK$10="DE",$B$10 & ", ",""))....etc.

I've looked at Lookup, but it doesn't seem to allow for finding numerous
occurances and listing them out. I could be mistaken though.

Please help!

Thank you,
Alison
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Creating a long string of text...

That returned just the first match, which is great, but I need all of the
matches.

It's so annoying because I know how to do this in VBA script by looping it,
but I want this to be via Worksheet Function.


"Don Guillett" wrote:

try this where you look for the FIRST match of de in the bk column and index
the b column

=INDEX($B$6:$B$10,MATCH("de",$BK6:$BK$10,-1))&","

--
Don Guillett
SalesAid Software

"AlieSlavin" wrote in message
...
Hi there,

I'm trying to figure out a better way to do this - since the formula is
already too long for the cell (and I don't want to split it between two
cells, I want to find a better, more automatic way.

So this is my formula (same thing repeated with more cells)

=IF(BK$6="DE",($B$6 & ", "),"")&(IF(BK$7="DE",$B$7 & ",
",""))&(IF(BK$8="DE",$B$8 & ", ",""))&(IF(BK$9="DE",$B$9 & ",
",""))&(IF(BK$10="DE",$B$10 & ", ",""))....etc.

I've looked at Lookup, but it doesn't seem to allow for finding numerous
occurances and listing them out. I could be mistaken though.

Please help!

Thank you,
Alison




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Creating a long string of text...

AlieSlavin wrote...
I'm trying to figure out a better way to do this - since the
formula is already too long for the cell (and I don't want to
split it between two cells, I want to find a better, more
automatic way.

So this is my formula (same thing repeated with more cells)

=IF(BK$6="DE",($B$6 & ", "),"")
&(IF(BK$7="DE",$B$7 & ", ",""))
&(IF(BK$8="DE",$B$8 & ", ",""))
&(IF(BK$9="DE",$B$9 & ", ",""))
&(IF(BK$10="DE",$B$10 & ", ",""))....etc.

I've looked at Lookup, but it doesn't seem to allow for finding
numerous occurances and listing them out. I could be mistaken
though.


Excel doesn't provide a built-in function for generalized
concatenation. You could try Laurent Longre's MOREFUNC.XLL add-in,
from http://xcell05.free.fr/english/, which provides an add-in
function named MCONCAT, which you could use in an array formula like

=MCONCAT(IF($BK$6:$BK$1000="DE",$B$6:$B$1000&", ",""))

The problem with MCONCAT is that it's subject to the XLL interface's
inability to return strings longer than 255 characters. If your
concatenated string could exceed 255 characters, you'd need to use
VBA. One possibility may be found in the following article from the
Google Groups archive.

http://groups.google.com/group/micro...456a9e326b19a6

(or http://tinyurl.com/2go6pf ).

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Creating a long string of text...

AlieSlavin wrote...
That returned just the first match, which is great, but I need all
of the matches.

It's so annoying because I know how to do this in VBA script by
looping it, but I want this to be via Worksheet Function.

....

Then if you have, say, 1000 cells you need to check in col BK, so you
might need to concatenate up to 1000 cells in col B, the easiest
approach would be to use 1000 other cells to generate the result.

IV6:
=IF($BK$6="DE",$B$6&", ","")

IV7:
=IV6&IF($BK$7="DE",$B$7&", ","")

Fill IV7 down into IV8:IV1005. Cell IV1005 would evaluate to what you
want. If you want to use fewer cells, put more of the IF calls into
each cell. Excel doesn't make this easy to do with formulas.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Creating a long string of text...

MCONCAT was great, but it wouldn't work the if. So I made a silly, but
functional work around using it.

I created another sheet to match my 1st one. Only in the cells that would
have contained "DE" I put in
=IF(Sheet1!BJ5="DE",($B5 &", "),"")

Then on the main sheet used
=MCONCAT(DE!BJ5:BJ37)

Worked like a charm. :-)

Thank you to everyone for your help!!


"Harlan Grove" wrote:

AlieSlavin wrote...
I'm trying to figure out a better way to do this - since the
formula is already too long for the cell (and I don't want to
split it between two cells, I want to find a better, more
automatic way.

So this is my formula (same thing repeated with more cells)

=IF(BK$6="DE",($B$6 & ", "),"")
&(IF(BK$7="DE",$B$7 & ", ",""))
&(IF(BK$8="DE",$B$8 & ", ",""))
&(IF(BK$9="DE",$B$9 & ", ",""))
&(IF(BK$10="DE",$B$10 & ", ",""))....etc.

I've looked at Lookup, but it doesn't seem to allow for finding
numerous occurances and listing them out. I could be mistaken
though.


Excel doesn't provide a built-in function for generalized
concatenation. You could try Laurent Longre's MOREFUNC.XLL add-in,
from http://xcell05.free.fr/english/, which provides an add-in
function named MCONCAT, which you could use in an array formula like

=MCONCAT(IF($BK$6:$BK$1000="DE",$B$6:$B$1000&", ",""))

The problem with MCONCAT is that it's subject to the XLL interface's
inability to return strings longer than 255 characters. If your
concatenated string could exceed 255 characters, you'd need to use
VBA. One possibility may be found in the following article from the
Google Groups archive.

http://groups.google.com/group/micro...456a9e326b19a6

(or http://tinyurl.com/2go6pf ).


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a text string by reading content in multiple cells smaruzzi Excel Worksheet Functions 3 February 8th 07 05:12 PM
search for date in long string of text ryan00davis Excel Discussion (Misc queries) 4 August 11th 06 07:06 PM
Extract specific value from a long text string Dinesh Excel Worksheet Functions 4 August 11th 06 04:24 AM
Error: The text string you entered is too long. GTVT06 Excel Worksheet Functions 2 June 16th 06 10:44 PM
Error: The text string you entered is too long. GTVT06 Excel Discussion (Misc queries) 0 June 16th 06 06:41 PM


All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"