Formula to list each unique value in a list only once in a different column

asavocch

New Member
Joined
Apr 18, 2011
Messages
1
I have two columns of data, one is a 3 digit alphabetical code denoting a record type and the second is a 6 digit numeric code indicating a supplier. I need a formula that will list, in a 3rd column the unique records in the 2nd column according to the record type. I need to have the record types grouped together and the suppliers sorted ascending.

Ideally, the solution would work as shown with the formula producing the data in column 3: I don't want to use a macro for this, it needs to be a formula and I cannot perform any filtering. This is a fixed format worksheet and can't be changed. Please help.

Col1 Col2 Col3
RBT 121011 RBT121011
RBT 121011 RBT122011
RBT 122011 RBT122012
RBT 122012 PKI403011
PKI 403011 PKI 403012
PKI 403011 BLK403011
PKI 403012 BLK403012
PKI 403012 BLK403011
BLK 403011 BLK403012
BLK 403011 BLK701011
BLK 403012 BLK701012
BLK 701011
BLK 701011
BLK 701012

I'm currently using an INDEX($A3:$A$34,MATCH(TRUE,INDEX($A3:$A$34<>A1,0),0)) formula which only partially works. It cannot negotiate the values in the first column to group them and instead skips them even if they are a different record type.
 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
asavocch,

Welcome to the MrExcel forum.


Using a helper column B. The below will create a uqique sorted list in column C.


Excel Workbook
ABCD
1RBT121011RBT121011BLK403011
2RBT121011RBT121011BLK403012
3RBT122011RBT122011BLK701011
4RBT122012RBT122012BLK701012
5PKI403011PKI403011PKI403011
6PKI403011PKI403011PKI403012
7PKI403012PKI403012RBT121011
8PKI403012PKI403012RBT122011
9BLK403011BLK403011RBT122012
10BLK403011BLK403011
11BLK403012BLK403012
12BLK701011BLK701011
13BLK701011BLK701011
14BLK701012BLK701012
15
Sheet1





The formula in cell C1 copied down to the end of your data in column B:

=A1&B1





The array formula in cell D1, confirmed with CTRL + SHIFT + ENTER (not just ENTER) copied down until the cell displays a blank cell:

=IF(ROWS($D$1:D1)>SUMPRODUCT(($C$1:$C$14<>"")/COUNTIF($C$1:$C$14,$C$1:$C$14&"")),"",INDEX($C$1:$C$14,MATCH(SMALL(IF(COUNTIF(OFFSET($C$1,0,0,ROW($C$1:$C$14)-ROW($C$1)+1,1),$C$1:$C$14)=1,COUNTIF($C$1:$C$14,"<"&$C$1:$C$14)),ROWS($D$1:D1)),IF(COUNTIF(OFFSET($C$1,0,0,ROW($C$1:$C$14)-ROW($C$1)+1,1),$C$1:$C$14)=1,COUNTIF($C$1:$C$14,"<"&$C$1:$C$14)),0)))

 
Upvote 0
asavocch,

Using a helper column C. The above will create a uqique sorted list in column D.
 
Upvote 0
asavocch,

Your request was for a unique list of values, and the following array formula will create the list without a helper column

Sheet1

<TABLE style="BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 2pt; PADDING-RIGHT: 2pt; FONT-FAMILY: Calibri,Arial; FONT-SIZE: 11pt" border=1 cellSpacing=0 cellPadding=0><COLGROUP><COL style="WIDTH: 30px; FONT-WEIGHT: bold"><COL style="WIDTH: 72px"></COLGROUP><TBODY><TR style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt; FONT-WEIGHT: bold"><TD> </TD><TD>C</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">3</TD><TD>RBT121011</TD></TR></TBODY></TABLE>
<TABLE style="BORDER-BOTTOM-STYLE: groove; BORDER-BOTTOM-COLOR: #00ff00; BORDER-RIGHT-STYLE: groove; BACKGROUND-COLOR: #fffcf9; BORDER-TOP-COLOR: #00ff00; FONT-FAMILY: Arial; BORDER-TOP-STYLE: groove; COLOR: #000000; BORDER-RIGHT-COLOR: #00ff00; FONT-SIZE: 10pt; BORDER-LEFT-STYLE: groove; BORDER-LEFT-COLOR: #00ff00"><TBODY><TR><TD>Spreadsheet Formulas</TD></TR><TR><TD><TABLE style="FONT-FAMILY: Arial; FONT-SIZE: 9pt" border=1 cellSpacing=0 cellPadding=2><TBODY><TR style="BACKGROUND-COLOR: #cacaca; FONT-SIZE: 10pt"><TD>Cell</TD><TD>Formula</TD></TR><TR><TD>C3</TD><TD>{=INDEX($A$3:$A$34&$B$3:$B$34,SMALL(IF(MATCH($A$3:$A$34&$B$3:$B$34,$A$3:$A$34&$B$3:$B$34,0)=ROW(INDIRECT("1:"&ROWS($A$3:$A$34))),MATCH($A$3:$A$34&$B$3:$B$34,$A$3:$A$34&$B$3:$B$34,0),""),ROW(A1)))}</TD></TR></TBODY></TABLE></TD></TR><TR><TD>Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!
</TD></TR></TBODY></TABLE>

Excel tables to the web >> http://www.excel-jeanie-html.de/index.php?f=1" target="_blank"> Excel Jeanie HTML 4


After copying it down in Column C, it will give #NUM! errors after the last unique value. If you have Excel 2007, you can convert the errors to empty cells by putting the formula inside the IFERROR function like this

Sheet1

<TABLE style="BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 2pt; PADDING-RIGHT: 2pt; FONT-FAMILY: Calibri,Arial; FONT-SIZE: 11pt" border=1 cellSpacing=0 cellPadding=0><COLGROUP><COL style="WIDTH: 30px; FONT-WEIGHT: bold"><COL style="WIDTH: 72px"></COLGROUP><TBODY><TR style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt; FONT-WEIGHT: bold"><TD> </TD><TD>C</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">3</TD><TD>RBT121011</TD></TR></TBODY></TABLE>
<TABLE style="BORDER-BOTTOM-STYLE: groove; BORDER-BOTTOM-COLOR: #00ff00; BORDER-RIGHT-STYLE: groove; BACKGROUND-COLOR: #fffcf9; BORDER-TOP-COLOR: #00ff00; FONT-FAMILY: Arial; BORDER-TOP-STYLE: groove; COLOR: #000000; BORDER-RIGHT-COLOR: #00ff00; FONT-SIZE: 10pt; BORDER-LEFT-STYLE: groove; BORDER-LEFT-COLOR: #00ff00"><TBODY><TR><TD>Spreadsheet Formulas</TD></TR><TR><TD><TABLE style="FONT-FAMILY: Arial; FONT-SIZE: 9pt" border=1 cellSpacing=0 cellPadding=2><TBODY><TR style="BACKGROUND-COLOR: #cacaca; FONT-SIZE: 10pt"><TD>Cell</TD><TD>Formula</TD></TR><TR><TD>C3</TD><TD>{=IFERROR(INDEX($A$3:$A$34&$B$3:$B$34,SMALL(IF(MATCH($A$3:$A$34&$B$3:$B$34,$A$3:$A$34&$B$3:$B$34,0)=ROW(INDIRECT("1:"&ROWS($A$3:$A$34))),MATCH($A$3:$A$34&$B$3:$B$34,$A$3:$A$34&$B$3:$B$34,0),""),ROW(A1))),"")}</TD></TR></TBODY></TABLE></TD></TR><TR><TD>Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!
</TD></TR></TBODY></TABLE>

Excel tables to the web >> http://www.excel-jeanie-html.de/index.php?f=1" target="_blank"> Excel Jeanie HTML 4
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

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