concatenate identical cells

johnny52

Active Member
Joined
Oct 13, 2006
Messages
332
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
I have identical data in cells A2 and B2 in cell c2 I would like to concatenate them but only showing one.....like if(a2=b2,a2,"") and if(a2=b2,b2,"") won't work to put in cell c2.

I was trying a trim formula but not having any luck....I think I'm making this harder than it should be

Something like this....but obviously (not to me) isn't working

=TRIM(A2&IF(COUNTIF(A2:B2,A2)>1,"",","&B2)&IF(COUNTIF(A2:B2,B2)>1,"",","&B2))

Thanks everybody
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I would like to concatenate them but only showing one
This seems to me to be contradictory, if you only want to show one value, then you do not need to concatenate them.
Can you please post some sample data & expected outcome, using the XL2BB add-in.
 
Upvote 0
I have identical data in cells A2 and B2 in cell c2 I would like to concatenate them but only showing one.....like if(a2=b2,a2,"") and if(a2=b2,b2,"") won't work to put in cell c2.
if A2 and B2 are the same then you only need to return either A2 or B2
so =IF( A2=B2, A2, "")

why does that not work
if they are not = then concatenate

so =IF( A2=B2, A2, A2&B2)
 
Upvote 0
=IF( A2=B2, A2, A2&B2)
This seems to me to be contradictory, if you only want to show one value, then you do not need to concatenate them.
Can you please post some sample data & expected outcome, using the XL2BB add-in.
ok

I put this formula into the worksheet and it worked......still think you were right....but when I concatenated the two cells with the same identical content, they both appeared (duplicated) in the new cell with the earlier formulas I mentioned. Not sure why...but it worked with this one.

Thanks everybody.

=IF(G1=H1,CONCATENATE($G1,IF(EXACT($G1,$H1),"")),CONCATENATE(G1,H1))
 
Upvote 0
if A2 and B2 are the same then you only need to return either A2 or B2
so =IF( A2=B2, A2, "")

why does that not work
if they are not = then concatenate

so =IF( A2=B2, A2, A2&B2)
ok

I put this formula into the worksheet and it worked......still think you were right as well....but when I concatenated the two cells with the same identical content, they both appeared (duplicated) in the new cell with the earlier formulas I mentioned. Not sure why...but it worked with this one.

Thanks everybody.

=IF(G1=H1,CONCATENATE($G1,IF(EXACT($G1,$H1),"")),CONCATENATE(G1,H1))
 
Upvote 0

Forum statistics

Threads
1,215,061
Messages
6,122,921
Members
449,094
Latest member
teemeren

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