Conditional concatenation?

C

Colin Hayes

Hi

I have a problem which I need to solve.

In Column A 1-30 I have some cells containing a number and some cells
are empty.

In column B 1-30 I have text in every cell.

I need to concatenate the two columns , but only where columns A and B
both have content.

I need the blank cells in A to remain blank after the concatenation ,
and those that have content to be successfully concatenated with the
equivalent cell column B - is this possible?

Grateful for any help.



Best Wishes


Colin
 
D

daddylonglegs

You can't do that directly in column A without using VBA.

You could use another column, e.g. in C1

=IF(A1="","",A1&B1)

copy down to C30. If you wish you could now copy C1:C30 and use Edit
Paste Special > Values to paste into A1:A3
 
C

Colin Hayes

daddylonglegs
You can't do that directly in column A without using VBA.

You could use another column, e.g. in C1

=IF(A1="","",A1&B1)

copy down to C30. If you wish you could now copy C1:C30 and use Edit >
Paste Special > Values to paste into A1:A30

HI

OK thanks for that - I'm grateful.

Unfortunately , I think it does need to be VBA. I need it to say that if
the cell has content then concatenate , and if the cell is empty then
don't concatenate. I have an existing macro which I want to fit this
code into. The above does the trick exactly as I need , but I wouldn't
know how to fit it into my macro..



Best Wishes


Colin
 

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