Duplicates and Sort Formula

kyle_04

Board Regular
Joined
Sep 26, 2009
Messages
68
Hi,

I have been trying to find a solution for removing duplicates and sorting data in alphabetical order. I found a couple of formulas but the following is the closest I have got for what I need. However it doesn't sort the data in alphabetical order (Leaving any zeros at the bottom, or deleting out if possible). Formulas in sheetA as follows:

Excel Workbook
AB
2MASTERFILE NUMBER67390
3
4
5Order Number
682513
782519
8 
92345
10 
11 
SheetA


Column A is pulling data from the following sheetB:

Excel Workbook
BC
28252460657
38251367390
48251967390
567390
68252088903
7234567390
88251967390
sheetB


As you can see the formula in sheetA (Column A) is working and removing duplicates (82519 for example), and is based on the criteria set out in B2 on sheetA (linked to column C in sheetB), however it is putting them in the order it finds them, including any blank spaces. Is there any way round this?

Kyle
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi Kyle,

If you couldn't get any joy with the link, perhaps this will work for you...

Excel Workbook
BC
1Order NumbersMaster File Numbers
28252460657
38251367390
48251967390
567390
68252088903
7234567390
88251967390
98252460657
108251367390
118999967390
128252088903
138251967390
SheetB


Excel Workbook
ABC
1***
2Master File Number673908
3***
4***
5Order Numbers**
62345**
782513**
882519**
989999**
10#NUM!**
11#NUM!**
12#NUM!**
13#NUM!**
14***
SheetA


The formula in A6 needs entering with ctrl - shift - enter NOT enter, you can then copy it down as far as is required. I'm unsure how best to avoid the #NUM! beside using this formula.....

=IF(ISERR(IF(ROWS(A$6:A6)<=$C$2,SMALL(IF(SheetB!$C$2:$C$13=$B$2,IF(ISNA(MATCH(SheetB!$B$2:$B$13,SheetA!$A$5:A5,0)),SheetB!$B$2:$B$13)),1),"")),"",IF(ROWS(A$6:A6)<=$C$2,SMALL(IF(SheetB!$C$2:$C$13=$B$2,IF(ISNA(MATCH(SheetB!$B$2:$B$13,SheetA!$A$5:A5,0)),SheetB!$B$2:$B$13)),1),""))

I hope that helps you.

Good luck.

Ak
 
Upvote 0
Thanks for the reply,

I have already watched that helpful video, but the formula kind of evolved since then.

The formula posted works perfectly, the only issue is that when I add it into sheetA cell C6 a space appears, not sure if that happens with you?


Kyle
 
Upvote 0
Hi Kyle,

That's interesting and this is baffling.
I have just reproduced the data and formula and I now get this....


Excel Workbook
ABC
1***
2Master File Number673908
3***
4***
5**Order Numbers
6**0
7**2345
8**82513
9**82519
10**89999
11**#NUM!
12**#NUM!
13**#NUM!
SheetA



I'm unsure as to why this has happened, obviously the formula I gave is flawed, sorry about that, my limited knowledge prevents me from correcting it :confused:

Hopefully someone will read this and provide a more accurate formula for you.

Ak
 
Upvote 0
Hi Kyle,

Try this in C6

=IF(ISERR(IF(ROWS(C$6:C6)<=$C$2,SMALL(IF(SheetB!$C$2:$C$13=$B$2,IF(ISNA(MATCH(SheetB!$B$2:$B$13,SheetA!$C$5:C5,0)),SheetB!$B$2:$B$13)),ROWS(C$6:C6)+1),"")),"",IF(ROWS(C$6:C6)<=$C$2,SMALL(IF(SheetB!$C$2:$C$13=$B$2,IF(ISNA(MATCH(SheetB!$B$2:$B$13,SheetA!$C$5:C5,0)),SheetB!$B$2:$B$13)),ROWS(C$6:C6)+1),""))


Excel Workbook
ABC
1
2Master File Number673908
3
4
5Order Numbers
62345
782513
882519
9
10
11
12
13
SheetA



Hopefully that has resolved the problem for you, fingers crossed.

Ak
 
Last edited:
Upvote 0
Nice try but it didn't work, the record 82513 didn't show up.

Not to worry I'll figure a way round it,

Thanks,

Kyle
 
Upvote 0
Hi Kyle,

Take a look at my sample file here....


Kyle04.xls



Excel Workbook
BC
1BC
28252460657
38251367390
48251967390
567390
68252088903
7234567390
88251967390
SheetB




Excel Workbook
ABC
1***
2MASTERFILE NUMBER673903
3*
4*
5*Order Number
6*2345
7*82513
8*82519
9**
SheetA



I hope that works for you.

Ak
 
Upvote 0

Forum statistics

Threads
1,224,514
Messages
6,179,223
Members
452,896
Latest member
IGT

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