Finding Unique Values among several rows

brohymn62

New Member
Joined
Aug 15, 2013
Messages
21
I have several columns of data as seen below:


ROW 1VALUE ROW 2VALUE
70047104
70547502
71047563
75047105
75027114
75037022

<tbody>
</tbody>

I am trying to find a way to search through this table... find the unique values in row 1 and 2, then create a dynamic list based on which how many unique values are found. I have only been able to do this on one column... help is much appreciated!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I have several columns of data as seen below:


ROW 1
VALUE
ROW 2
VALUE
700
4
710
4
705
4
750
2
710
4
756
3
750
4
710
5
750
2
711
4
750
3
702
2

<tbody>
</tbody>

I am trying to find a way to search through this table... find the unique values in row 1 and 2, then create a dynamic list based on which how many unique values are found. I have only been able to do this on one column... help is much appreciated!

What is your version of Excel?
 
Upvote 0
I use 2010 but I am creating this for compatibility with 2003.

Add the following code to your work, using Alt + F11:

Function ArrayUnion(ParamArray Arg() As Variant) As Variant
' Code: Juan Pablo González
' Spec: Aladin Akyurek
' May 4, 2003
' Ref: TinyURL.com - shorten that long URL into a tiny URL
Dim TempUnion() As Variant
Dim i As Long, Itm As Variant, Ctr As Long
For i = LBound(Arg) To UBound(Arg)
Arg(i) = Arg(i)
If IsArray(Arg(i)) Then
For Each Itm In Arg(i)
Ctr = Ctr + 1
ReDim Preserve TempUnion(1 To Ctr) As Variant
TempUnion(Ctr) = Itm
Next Itm
Else
Ctr = Ctr + 1
ReDim Preserve TempUnion(1 To Ctr) As Variant
TempUnion(Ctr) = Arg(i)
End If
Next i
ArrayUnion = TempUnion
End Function

Given the following data on Sheet1 (otherwise, adjust to suit the sheet name)...

XValueYValue Distinct Count
70047104 7
70547502 Distinct List
71047563 700
75047105 705
75027114 710
75037022 750
756
711
702

<colgroup><col style="width: 48pt;" span="5" width="64"> <col style="width: 170pt; mso-width-source: userset; mso-width-alt: 8049;" width="226"> <tbody>
</tbody>

Define List using Insert | Name | Define (or Formulas | Name Manager) as referring to:
Rich (BB code):
=arrayunion(Sheet1!$A$2:$A$7,Sheet1!$C$2:$C$7)

Define Ivec as referring to:
Rich (BB code):
=ROW(INDIRECT("1:"&COLUMNS(List)))

F2, control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(FREQUENCY(IF(List<>"",MATCH("~"&List,List&"",0)),Ivec),1))

F4, control+shift+enter and copy down:
Rich (BB code):
=IF(ROWS($F$4:F4)<=$F$2,
  INDEX(List,SMALL(IF(FREQUENCY(IF(List<>"",
   MATCH("~"&List,List&"",0)),Ivec),Ivec),ROWS($F$4:F4))),"")
 
Upvote 0

Forum statistics

Threads
1,215,580
Messages
6,125,654
Members
449,245
Latest member
PatrickL

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