Combine Unique Values in the top Empty Cell

zmaniar

New Member
Joined
Sep 24, 2021
Messages
10
Office Version
  1. 2019
Platform
  1. MacOS
Hello. I need help with this issue. I need to add UNIQUE Value from the below cells comma separated unit there is an empty cell. This is required from product upload. I have bold the data which I need by VBA.

After row 10 there is an empty cell. So the script will run from Row 3 - 12 and should put the data in Row 2. Then again from 14 - 27 and put the data in Row 13.

PositionAttribute 1 nameAttribute 1 value(s)Attribute 1 visibleAttribute 1 globalAttribute 2 nameAttribute 2 value(s)Attribute 2 visibleAttribute 2 global
0​
SizeS, M, L, XL, 2XLColourBlack, Navy
1​
1​
1​
SizeS
1​
1​
ColourBlack
1​
1​
2​
SizeM
1​
1​
ColourBlack
1​
1​
3​
SizeL
1​
1​
ColourBlack
1​
1​
4​
SizeXL
1​
1​
ColourBlack
1​
1​
5​
Size2XL
1​
1​
ColourBlack
1​
1​
6​
SizeS
1​
1​
ColourNavy
1​
1​
7​
SizeM
1​
1​
ColourNavy
1​
1​
8​
SizeL
1​
1​
ColourNavy
1​
1​
9​
SizeXL
1​
1​
ColourNavy
1​
1​
10​
Size2XL
1​
1​
ColourNavy
1​
1​
Size3XL
1​
1​
ColourBlack/Graphite
1​
SizeS
1​
1​
ColourBlack/Graphite
1​
SizeM
1​
1​
ColourBlack/Graphite
1​
SizeL
1​
1​
ColourBlack/Graphite
1​
SizeXL
1​
1​
ColourBlack/Graphite
1​
Size2XL
1​
1​
ColourBlack/Graphite
1​
Size5XL
1​
1​
ColourBlack/Graphite
1​
SizeS
1​
1​
ColourNavy/Graphite
1​
SizeM
1​
1​
ColourNavy/Graphite
1​
SizeL
1​
1​
ColourNavy/Graphite
1​
SizeXL
1​
1​
ColourNavy/Graphite
1​
Size2XL
1​
1​
ColourNavy/Graphite
1​
Size3XL
1​
1​
ColourNavy/Graphite
1​
Size5XL
1​
1​
ColourNavy/Graphite
1​
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Could use this UDF.

Book10
ABCDEFGHI
1PositionAttribute 1 nameAttribute 1 value(s)Attribute 1 visibleAttribute 1 globalAttribute 2 nameAttribute 2 value(s)Attribute 2 visibleAttribute 2 global
20SizeS, M, L, XL, 2XLColourBlack, Navy11
31SizeS11ColourBlack11
42SizeM11ColourBlack11
53SizeL11ColourBlack11
64SizeXL11ColourBlack11
75Size2XL11ColourBlack11
86SizeS11ColourNavy11
97SizeM11ColourNavy11
108SizeL11ColourNavy11
119SizeXL11ColourNavy11
1210Size2XL11ColourNavy11
Sheet2
Cell Formulas
RangeFormula
C2,F2:G2C2=uVAL(C3:C12)


VBA Code:
Function uVAL(r As Range) As String
Dim AR() As Variant:    AR = r.Value2

With CreateObject("Scripting.Dictionary")
    For i = 1 To UBound(AR)
        If Not .exists(AR(i, 1)) Then .Add AR(i, 1), 1
    Next i
    uVAL = Join(.keys, ", ")
End With
End Function
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,189
Members
452,616
Latest member
intern444

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