Concatenating help

mahmed1

Well-known Member
Joined
Mar 28, 2009
Messages
2,302
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi guys,

I have this formula to concatenate

=a1&", "&a2&" and" &a3

now what i need to have is if cell a3 is empty
change the concatenation to
a1 and a2.
if a2 and a3 are empty then display
A1.

Hope this makes sence

thanks
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi mahmed1,


An option could be:
Cell Formulas
RangeFormula
B1=IF(AND(A1<>"",A2<>"",A3<>""),A1&" "&A2&" "&A3,IF(AND(A1<>"",A2<>""),A1&" "&A2,IF(AND(A1<>""),A1,"")))

Hope this helps,

Regards
 
Upvote 0
here is solution dear.
=IF(COUNTA(A1:A3)=3,A1&", "&A2&" and "&A3,IF(COUNTA(A1:A2) = 2, A1 & " and " & A2,A1))
 
Upvote 0
If the "and" is not essential.... a simple comma space between each value would suffice, then try

=SUBSTITUTE(TRIM(A1&" "&A2&" "&A3)," ",", ")
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,845
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top