Concatenation

F

Francis Hookam

I am concatenating cells together and including &", "& between to provide a
comma and a space between pieces of info

Some of the cells contain data derived from further cells, although some may
be empty

So, I might have a formula which looks like this

=RC[13]&", "&RC[12]&", "&YEAR(RC[3])&IF(ISTEXT(RC[11]),", "&RC[11],"")

In the last part I have:

IF(ISTEXT(RC[11]),", "&RC[11],"")

which tests whether or not there is anything in RC[11]

BUT what is in RC[11] is already the result of a similar IF statement where
there may be something or just ""

Clearly the ISTEXT is not the right test since I always get the comma and
space even if there is nothing to be concatenated

Any suggestions?

Francis Hookham
 
J

JE McGimpsey

Francis Hookam said:
So, I might have a formula which looks like this

=RC[13]&", "&RC[12]&", "&YEAR(RC[3])&IF(ISTEXT(RC[11]),", "&RC[11],"")

In the last part I have:

IF(ISTEXT(RC[11]),", "&RC[11],"")

which tests whether or not there is anything in RC[11]

BUT what is in RC[11] is already the result of a similar IF statement where
there may be something or just ""

Clearly the ISTEXT is not the right test since I always get the comma and
space even if there is nothing to be concatenated

One way:

=IF(RC[11]<>"", ", " & RC[11], "")
 
B

Bob Greenblatt

Francis Hookam said:
So, I might have a formula which looks like this

=RC[13]&", "&RC[12]&", "&YEAR(RC[3])&IF(ISTEXT(RC[11]),", "&RC[11],"")

In the last part I have:

IF(ISTEXT(RC[11]),", "&RC[11],"")

which tests whether or not there is anything in RC[11]

BUT what is in RC[11] is already the result of a similar IF statement where
there may be something or just ""

Clearly the ISTEXT is not the right test since I always get the comma and
space even if there is nothing to be concatenated

One way:

=IF(RC[11]<>"", ", " & RC[11], "")

Or, another way, if you really want to see if the cell is empty and does not
contain a comma:

=if(len(rc[11])=0,"whatever","whatever else")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top