how to display the values i first column

divya g

New Member
Joined
Dec 12, 2018
Messages
4
intillwpowptrainingblack brinkphoto arkedge fellowsbcirhinooceanarcitic
barbaraxxx
barbaraxxxx
barbaraxxx
adamxxxx
adamxxx
adamxxx
adamxx

<tbody>
</tbody>

and here my question is i need to display all x in a one column and names have duplicates where ever x is there i have to display top most



expected table
intillwpowptrainingblack brinkphotoarkedge fellowsbcirhinooceanarctic
barbaraxxxxxxx
barbara
barbara

<tbody>
</tbody>
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Why does "barbara" appear 3 times in your output? Why isn't she just there once? The remaining two lines for her are blank and provide no information whatsoever since it's all on the first line.
 
Upvote 0
Try this:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG18Dec32
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] Lst [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Ac [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range("A2", Range("A" & Rows.Count).End(xlUp))
Lst = Cells("1", Columns.Count).End(xlToLeft).Column
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    [COLOR="Navy"]If[/COLOR] Not .Exists(Dn.Value) [COLOR="Navy"]Then[/COLOR]
        .Add Dn.Value, Dn
    [COLOR="Navy"]Else[/COLOR]
        [COLOR="Navy"]For[/COLOR] Ac = 1 To Lst
            [COLOR="Navy"]If[/COLOR] Not IsEmpty(Dn.Offset(, Ac).Value) [COLOR="Navy"]Then[/COLOR]
                .Item(Dn.Value).Offset(, Ac) = Dn.Offset(, Ac)
                Dn.Offset(, Ac).ClearContents
            [COLOR="Navy"]End[/COLOR] If
        [COLOR="Navy"]Next[/COLOR] Ac
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Hi,

Here is a solution for you:

In a new sheet, create a list of names, no replications as per your expected table above. In cell B2 paste:

=IF(COUNTIFS(Old!$A$2:$A$9,New!$A2,Old!B$2:B$9,"X")>0,"X","")

The old range should cover your current table range from top to bottom (EXCLUDING HEADER ROW!)

Try that and shout if you have any problems

Thanks
AJ

<tbody>
</tbody>
 
Upvote 0
Hi,

Here is a solution for you:

In a new sheet, create a list of names, no replications as per your expected table above. In cell B2 paste:

=IF(COUNTIFS(Old!$A$2:$A$9,New!$A2,Old!B$2:B$9,"X")>0,"X","")

The old range should cover your current table range from top to bottom (EXCLUDING HEADER ROW!)

Try that and shout if you have any problems

Thanks
AJ

<tbody>
</tbody>

I should add you can drag/copy that formula, left to right and top to bottom to get a single line result for each name

Nameintillwpowptrainingblack brinkphotoarkedge fellowsbcirhinooceanarctic
barbaraX X X XXXX
AdamX X X XXXXX

<colgroup><col width="64" span="12" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,216,111
Messages
6,128,899
Members
449,477
Latest member
panjongshing

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