Merge cells vertically if value is the same using a Formula

meaningofexcel

New Member
Joined
Jul 25, 2018
Messages
9
I have a table with Names in the first column, one name can have multiple rows.

i.e

ID Column Name | Column Results
1. Name1 Result 1
2. Name2 Result 4
3. Name2 Result 5
4. Name3 Result 1
5. Name4 Result 1
6. Name4 Result 2


and desired result is merging cells B2-B3, B5-B6:

ID Column Name | Column Results
1. Name1 | Result 1
---------------------|----------
2. | Result 4
Name2 |----------
3. | Result 5
---------------------|----------
4. Name3 | Result 1
---------------------|----------
5. | Result 1
Name4 |----------
6. | Result 2


Is that possible using formulas?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I would strongly advise that you avoid merged cells like the plague. They will cause you nothing but pain & grief.
 
Upvote 0
I would strongly advise that you avoid merged cells like the plague. They will cause you nothing but pain & grief.

Thanks,

Hm, now that you mention that I agree with you.

I'm thinking of a workaround.
For column A I hide the grid lines so it looks like a clean sheet.
I color the entire row only when the name changes.
And then just remove the duplicates using a helper column

=if(A2=A1,"",A1)

This works fine but how can I also "Shift" the name if the same name appears more than 2 times? This way the name will always stay in the middle of the range.
 
Upvote 0
Not a perfect solution, but you could use conditional formatting.
Select the range of values > Home Tab > Conditional formatting > New rule > Use a formula > format font & fill as white > Ok
The formula is
=AND(COUNTIF(D$4:D$11,D4)< >1,MOD(COUNTIF(D$4:D$11,D4),COUNTIF(D$4:D4,D4))< >1)
Change the ranges to suit
 
Upvote 0
If you have 3 of the same value then the middle one will be visible, if you have 4 then the 2nd one will be visible
 
Upvote 0

Forum statistics

Threads
1,213,556
Messages
6,114,284
Members
448,562
Latest member
Flashbond

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