Concatenate cells if, values of another column are the same as above

McBee1989

New Member
Joined
Nov 1, 2016
Messages
14
Hi,
I am having a bit of trouble with a nested IF statement...

Basically, I want column G to concatenate with the rows above it, IF, the values in column A are the same above. The number of values in column A varies from 2 - 9 so the formula I currently have doesn't work (pasted below).

=IF(A3<>A2,G3,IF(A3=A2,G3&"|"&G2))

So that work's if the values in column A only appear twice. However, if the value in column A appears 6, 7, 8 etc times, it doesn't work. Obviously I dont want it to concatenate if the value in column A changes to a new number.

Any help is appreciated.

Thanks
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You dont need the second IF

IF(A3<>A2 then G3 otherwise
A3 MUST equal A2 so no need to test it again with IF(A3=A2...

It should simply be

=IF(A3<>A2,G3,G3&"|"&G2)

or even

G3&IF(A3<>A2,"","|"&G2)

Obviously this doesnt solve your main problem but is an improvement on your existing formula
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,746
Messages
6,126,641
Members
449,325
Latest member
Hardey6ix

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