# Consolidating Table

#### dpmaki

##### Board Regular
I have a table like this:

 Number Trait 1 Trait 2 Trait 3 Trait 4 Trait 5 Trait 6 22 x 13 x 45 x 50 x 22 x 13 x 45 50 x 22 x 13 45 x 50 x

<colgroup><col width="64" span="7" style="width:48pt"> </colgroup><tbody>
</tbody>

I'm trying to come up with some VBA that would consolidate it into something like this:

 Number Trait 1 Trait 2 Trait 3 Trait 4 Trait 5 Trait 6 22 x x x 13 x x 45 x x 50 x x x

<colgroup><col width="64" span="7" style="width:48pt"> </colgroup><tbody>
</tbody>

Any suggestions on getting me started?

### 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.
Try this:-
NB:- This code will alter you data.!!!
Code:
``````[COLOR="Navy"]Sub[/COLOR] MG16Sep51
[COLOR="Navy"]Dim[/COLOR] Rng             [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] Dn              [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] n               [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] nRng            [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
[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]
[COLOR="Navy"]Else[/COLOR]
[COLOR="Navy"]For[/COLOR] n = 1 To 6
[COLOR="Navy"]If[/COLOR] Dn.Offset(, n).Value = "x" [COLOR="Navy"]Then[/COLOR] .Item(Dn.Value).Offset(, n).Value = "x"
[COLOR="Navy"]Next[/COLOR] n
[COLOR="Navy"]If[/COLOR] nRng [COLOR="Navy"]Is[/COLOR] Nothing [COLOR="Navy"]Then[/COLOR]
[COLOR="Navy"]Set[/COLOR] nRng = Dn
[COLOR="Navy"]Else[/COLOR]
[COLOR="Navy"]Set[/COLOR] nRng = Union(nRng, Dn)
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
[COLOR="Navy"]If[/COLOR] Not nRng [COLOR="Navy"]Is[/COLOR] Nothing [COLOR="Navy"]Then[/COLOR] nRng.EntireRow.Delete
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]``````
Regards Mick

Replies
2
Views
147
Replies
8
Views
100
Replies
0
Views
227
Replies
0
Views
87
Replies
7
Views
327

1,214,437
Messages
6,119,522
Members
448,903
Latest member
StephMJ

### 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.

### Which adblocker are you using?

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

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