# List And Sort Unique Values In Multi-column Range

Jan 26, 2012

In A1 of Sheet1!, I need a formula that lists and sorts all the 'unique' values from range

ECWP!\$O\$6:\$Q\$1505

## List Unique Values From A Named Range

Dec 4, 2007

I am trying to find a way to create a list of unique items from a named range. I have found a few solutions using filters for ranges that are contained in the one column but not named ranges that contain multiple rows and multiple columns.

Is there any way to copy all of the unique items from the named range to another location? Lets call the named range Table1 and it spans from B2 to J100.

## Extract Unique Values From Multi-Columns

Feb 20, 2013

I wan to extract Unique values, here is the data for reference, I have made to tables the second table is desire result I wanted.

Sheet30  ABCDEFG1JOB #WASHQTY JOB
#WASHQTY27800A1000 7800A100037801B1000 7801B100047802A1000 7802A100057800
A1000 7802C100067802C1000 7805B100077805B1000 7807D100087800A1000 7809D
100097807D1000    107802C1000    117809D1000

## Function To Sort A Range By The Values In A Specific Column And Return The Range

Mar 25, 2009

I was just recently forced to create my first UDF and after how well it worked I now am very interested in learning more. I am trying to create a function to sort a range by the values in a specific column and return the range. I know this should be really simple but for some reason my code dies whenever it gets to my inner-most loop. I need to use this in a larger function but for now this is my only question. I did find that Excel 2007 has built in Functions for this but my company still uses 2003.

My
Public Function SortRange(rngToSort As Range, valCol As Integer)
Dim Swapper As Variant
Dim i As Integer, _
j As Integer, _
k As Integer

For i = 1 To rngToSort.Rows.Count
For j = 1 To rngToSort.Rows.Count - i
If rngToSort(j + 1, valCol) < rngToSort(j, valCol) Then
For k = 1 To rngToSort.Columns.Count
Swapper = rngToSort(j, k)
rngToSort(j, k) = rngToSort(j + 1, k)
rngToSort(j + 1, k) = Swapper
Next k
End If
Next j
Next i
SortRange = rngToSort
End Function

## Dropdown List Always Shows Unique Values From Column Based On Lookup Value

Jul 22, 2014

I have a worksheet (say, Sheet1) that I am going to manually import a large data set into on a weekly basis for reporting purposes. One of the columns from this data dump will have the header "Design Id" in the first row, but it may not be in the same column every time. I am trying to figure out how to create dropdown lists on a separate worksheet (say, Sheet2) in the same workbook where the data source always looks up the column containing the header "Design Id" from Sheet1 and then returns only the unique values from that column as options in the list.

## Sort ListBox2 Multi-Column Upside Down

Sep 29, 2011

I have listbox1 MultiSelectExtended (2 columns). If the items are selected I add them to listbox2 (also in 2 columns) with a CommandButton. The problem is that the code I have in the CommandButton adds them upside down!

I want to transfer from listbox1 to listbox 2 in the same order as listbox1 (Top to Bottom)

This is the code:

With ListBox1
For eCount = .ListCount - 1 To 0 Step -1
If .Selected(eCount) = True Then ' if selected then
ListBox2.Column(1, ListBox2.ListCount - 1) = .List(eCount, 1) 'add to listbox2, Column 1
End If
Next
End With

## Creating Unique List Of Values From Column Of Data Across Multiple Sheets No Blanks

Jul 8, 2014

I have 6 worksheets in my file. In sheets 1-5, column A2:A26 list people's names. Some people's names appears on more than one sheet. Not all cells are populated with a value.

ex.
SHEET1
COLUMNA
Bill

[Code]....

My attempt was... =INDEX('Week1:Week5-!\$A\$2:\$A\$26,MATCH(0,COUNTIF(\$A\$1:A1,"Week1:Week5"!\$A\$2:\$A\$26),0))

where the sheets were Week1-Week5 and the values on each sheet was A2:A26. But I think there's an issue with Excel being able to 3D reference for these types of functions.

## Return Unique ID Based On Multi-Column Lookup

Dec 18, 2008

I'm looking for a formula (VBA I'm assuming) that will help me create a unique customer ID out of data that my website generates in order to import records into my accounting system.

I have a current list of customers in CSV format with the columns: CustomerID, CustomerName, CustomerZip

Each customer in our accounting system is assigned a unique,7 digit CustomerID in the format of XXX#### where XXX are the first 3 letters of their last name, and #### is a 4 digit number (with leading 0's) to create unique ID's for customer with the same first 3 characters of their last name. SAMPLE LIST:

SCH0001, Lindsey Schubert, 75230
SCH0002, Thomas Schoembs, 53132
...

What I'd like to do is pass the formula 3 parameters (Cust_First_Name, Cust_Last_Name, Zip) and have it parse the .CSV file and either return an existing customer's current ID or generate the appropriate new, unique ID, making sure in increase the 4 digit # accordingly and insert leading 0's if necessary.

Another caveat, if possible to work with, is the ability to also pass the formula another range of cells to append to the end of the .CSV file's data for comparison reasons. There are times when I'll bulk-import orders (or we receive numerous in the same batch) and the potential exists to have two customers that would have the same CustomerID created using JUST the .CSV data. Ie. If we use the example above and have new customers of Steve Schwab and Julie Schwitzer - we'd end up incorrectly assigning them both SCH0003, where if we'd read Steve Schwab's newly created info and customer ID of SCH0003, then Schwitzer would correctly be assigned SCH0004.

## Data Manipulation - How To Dynamically Filter And Sort Multi-column Dataset

Mar 15, 2013

Data manipulation question here: how to dynamically filter and sort a multi-column data set? My end goal is to be able to (1) quickly collapse all columns into one single column, (2) remove all duplicates, and (3) sort the information in ascending order. A reference sheet is attached in case it's useful.

## Extract Unique Values From Column B Between Date Range Textbox1 And Textbox2

Jul 3, 2007

Sheet1 has following two columns

----A----------B
01-07-2007---10
01-07-2007---20
02-07-2007---30
02-07-2007---40
02-07-2007---40
03-07-2007---60
03-07-2007---70
03-07-2007---70
03-07-2007---90
04-07-2007---100
04-07-2007---110

Sheet2 has following three cotrols

Textbox1=02-07-2007
Textbox2=03-07-2007
combobox=?

I want to Extract Unique values from column B between date range textbox1 and textbox2 and finally how to add these unique records in combox1

## Rank & Sort Table: Unique Numbers Sort Ascending, But The Non-unique Numbers Sort Descending

Oct 5, 2007

I have a list in rows where I have a ranking formula =COUNT(\$G\$5:\$G\$81)-(RANK(G5,\$G\$5:\$G\$81)+ COUNTIF(\$G\$5:G5,G5)-1)+1 When I sort the rank, ascending. All of the unique numbers sort ascending, but the non-unique numbers sort descending

ex) 1.751
2.52
3.753
418
417
416

## Sort Unique, Then Copy From Original List

Mar 1, 2004

I have a CSV spreadsheet full of data: many rows and many columns. I want to sort based on values in some column. Then, I want to divide my large worksheet into smaller worksheets based on these sorted column values. For instance, if column 4 was 20,000 items long and contained 6 unique values I would want to create 6 smaller spreadsheets. Each spreadsheet would still have a column 4. Now, however, all the column 4 values would be the same for a particular spreadsheet. It would be nice to have a pop-up window query me for which column to use to divide the data with, instead of hardcoding a value in (like 4).

I am trying to crank this CSV file through MATLAB and it is just too big. My PC has 1GB memory and it still craps out. I am guessing that a dozen or so smaller files will be easier for MATLAB to digest. Any help is appreciated!

For the record, I am doing the following to sort a column, then copy it to a scratch worksheet and then determine all the unique values. I have hardcoded in column lengths and would really like to know how to make these variable expressions:

Sub divide_and_conquer()

Dim lngSheet As Long
Dim strName As String

Range("A1:HR778").Sort Key1:=Range("D2"), Order1:=xlAscending, Key2:= _
Range("B2"), Order2:=xlAscending, Key3:=Range("E2"), Order3:=xlAscending _
, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, _.............

## Creating Single Column List From Multi-row / Column Table And Removing Blanks

Mar 7, 2014

I'm trying to come up with a single formula to create a single column list from a table with blanks.
a

b

c
d

e

f
g

To
a
b
c
d
e
f
g

I know I've done this before but having trouble visualizing today.

## Macro To Convert Multi-column Table To 3 Column List

Aug 2, 2012

a macro to convert this;

a
b
c
d

[Code]...

Into this;

x
a
9
x
b

[Code]...

So far I have the following, but this is not quite right!

[QUOTE][Sub ConvertRange()
Dim targetRowNumber As Long
targetRowNumber = Selection.Rows(Selection.Rows.Count).Row + 2
Dim col1 As Variant

[Code]...

/QUOTE]#

## Extract Unique Distinct List From Two Columns With Array Formula And Sort From A To Z

May 30, 2014

I have two lists in different columns, which are defined ranges. I want to extract them to a unique list with an array formula and at the same time sort albafetically, without duplicates, like this:

List1
List2

Final List

Audi
Ford

[Code] ....

So far, I have this formula which is working in what concerns removing duplicates and exctract a unique list. But it is not ordering alfabeticaly.

{=IFERROR(IFERROR(INDEX(List1, MATCH(0, COUNTIF(\$D\$1:D1, List1), 0)), INDEX(List2, MATCH(0, COUNTIF(\$D\$1:D1, List2), 0))), "")}

## 2 Column Horizontal List To Multi-Column Table

Aug 24, 2008

I am trying to create a macro that converts a large list of Customer details from a vertical to horizontal format.

Each Customer has a unique sequential number running from 1 but the details are not always the same (e.g. in the below Phone does not always appear).

Current format is per the below:

Before

Column A Column B

Customer1
Phone 1234
Customer2
Amount 25
Customer3
Amount 500
Phone 567

Format afterwards should be

1 ABC 1234
2 25 XYZ
3 500PQRS 567

## How To Fill Multi-Column List View

Nov 9, 2013

How to fill a multi-column ListView? I can get the first column, but not the second.

## Adding Items To Multi Column List Boxes

Oct 9, 2003

I am using a ComboBox to get a value from the user. The code below will then check my worksheet and if it finds the value will place it into my ListBox.

Dim x As String
myvalue = ComboBox1.Value
A = 5
Do
x = Sheet1.Cells(A, 4).Value
If x = "" Then Exit Sub
If x = myvalue Then Me.ListBox1.AddItem x
A = A + 1
Loop Until Sheet1.Cells(A, 4).Value = ""

The problem is how to alter this code to place the value from column 5 into the ListBox as well as the Value from column 4

## Move Records Between 2 Multi-column List Boxes

Jan 28, 2008

i want to do is transfer records held in one list box to another list box when a command button is clicked. The list boxes both contain 6 columns. My code is attatched

## Obtaining List Of Unique Values From List Based On Some Criteria?

May 28, 2014

The function below should return the value in a cell IF the string in the cell two cells to the left of it is "Nemo" Omitting the part highlighted in blue, my function returns a list of unique values...but when it's included, nothing is returned at all. Perhaps, there is an error in the syntax that I'm overlooking?

Function listUnique(rng As Range) As Variant
Dim row As Range
Dim elements() As String

[Code]....

## Copy Multi-Column/Row Range Into Single Column

Apr 8, 2008

I have a contiguous multi column, multi row numeric range that I want to copy (and sort in ascending order) into a single column on another sheet in the same workbook. What VBA code could achieve this, or alternatively can this be achieve via formulas?

## Excel 2010 :: Produce Unique List Of Key Values With Second Values Concatenated Together

Sep 15, 2013

I have some data with recurring key values and differing values in the second column, I need to produce a unique list of key values with the second values concatenated together.(See below)

The data can be 10 rows to 5000 and I can have anything from 5 to 150 sheets (Separate data sets), a macro would go a long way to keeping me sane.

Sample data Required Output
A | B Z
1| 10 | a 10,a,b,c
2| 10 | b 11,a
3| 10 | c 12,a,b
4| 11 | a
5| 12 | a
6| 12 | b

My system is Windows 8 Excel 2010.

## Formula For Obtaining List Of Unique Values But Not Including Values Which Contain IC

Aug 14, 2014

1. Using a formula, I am trying to to obtain a list of unique values (string) (caveat: see #2) from the range E2:E10000 (arbitrarily chose 10000 - the row number is variable)(see #3).

I currently have a formula that seems to work for this purpose but I don't know how to add the condition in #2 (below)

2. To include all unique string values except those starting with the letters "IC"

3. Is there a way to make this formula so that it can only seek values up to the last row, and not go to the 10000th row if not necessary? The E column has no empty cells until after the last row that contains data.

Here is the formula I currently use which serves #1 (above):

[Code] .....

Any way to improve/simplfy this formula for the purpose describbed in #1? How can I add the condition in #2? Can you see a way to include #3? The most important issue here is #2.

Example of desired results:

Column A | Column B
AA | AA
DD | CC
AA | DD
CC |
DD |
DD |
IC |
IC |

## How To Get Unique List From A Column To Data Validation Dropdown List

Oct 28, 2011

I'm looking for a way to get a unique list from a column to a data validation drop down list. Any fancy formula or vba script to create a UDF which. Does this?

## Find Value In Multi-column Range And Return Value

May 27, 2008

I have a chart:

ABCDE126143199167233153143310351018220110246817085151581166230162692149206173711417214213281273781662029132178200255

I need a formula to find the maximum value in C1:E9 and return the corresponding number in column A. In this instance, the answer would be 12. I've been trying to make it work with a combination of Offset and Max formulas, but since the maximum could be in any one of three columns, I don't know how to make it work.

## Multi Columned Range To Single Column

Mar 7, 2008

I have numbers in a range over an indeterminate number of rows and 6 columns. I want to create a single column of the numbers with no blank cells in between. It's to check Visa receipts from different depts.

## Return Row Index Of Selected Items In Multi Column Multi Select Listbox

Jun 30, 2014

I have a listbox with 8 columns. Multiselect is enabled, and it must stay this way. As part of my program, after the user presses a command button, I need to use the row indexes of the selected rows in order to copy the selected information into an array which is then placed in a different listbox, and then delete the items from the original list. Pseudocode of what I want to do:

[Code] .....

But my understanding is that .ListIndex does not work this way with multiselect listboxes. I've tried searching for a solution for a while, but I cannot find one.

## Add Items: Multi Column ListBox: Non-Contiguous Range

Sep 6, 2006

i have several listbox with two columns in a userform in a sheet i have several columns whith values and i'm trying to put the values from the columns in the respective listbox. down is the code i wrote but is stressing with column command

Private Sub UserForm_Initialize()
Dim contar, j, i As Double
Sheets("Historico").Select
contar = 0
For j = 1 To 15
linha = j
For i = 3 To 65536

## Unique Values From List Of Many Duplicate Values?

Jan 31, 2014

how to get this with formula:

Column A - - Column B
a - - - - - - - a
a - - - - - - - b
b - - - - - - - c
c
c

## Summing Up Values In Column Corresponding To Unique Distinct Values In Another Column?

Dec 24, 2013

I have two columns in excel, col A and col B.What I would want to achieve is following:

Col A Col B
A 2
A 2
A 2
B 3
B 3
B 3
B 3
C 3
C 3
C 3

Now I want a total of values in column B pertaining to unique (or say 1st occurences) of values in Col A. So in this case the output should be 8 ,Achieved as follows(2 +3+3).

[URL]