Issue with Duplicate when sorting a column based another column

Little_Tiger

New Member
Joined
May 7, 2018
Messages
10
Does anyone could help me with the following:
I have the following table
A B C D E F
Value ToSort NormalDuplicate number ROW()Correct
5122
4224
9325
441541
453653
11461212
15777
167899
18966
1564101313
16541188
14121010
158131111
16941141414
/=IFERROR(VLOOKUP(SMALL(IF(B$2:B$15;A$2:A$15);ROWS($2:2));A$2:B$15;2;FALSE);"")
/=IF(COUNTIFS($A$1:$A2; A2)>1;ROW();"")

<colgroup><col span="3"><col><col span="5"></colgroup><tbody>
</tbody>

With the formula in C, it is possible to sort column B based on the value in column A. However, as you can see, the first 3 rows in Column C are all "2". (Column F is the correct way Column C should be sorted). This is wrong, as Column F shows. In Column D, I can find the duplicates, and in which respective Cell the duplicates are.

How can I combine the 2 formula, so that if there a duplicate that is move the next one to return the correct value from column B. In principle, I'm trying to get a formula to returns column F.

Thanks
-=LT=-
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Can we still use a helper column (D below)? It could be hidden after entering the formulas.
Each formula copied down.

Excel Workbook
ABCD
1ValueToSortSortedHelper
25124.000002
34241.000003
49355.000004
54411.000005
64531.000006
71146129.000007
815777.000008
91678911.000009
1018968.00001
111564101312.000011
12165411813.000012
131412106.000013
14158131110.000014
1516941141414.000015
Sorted
 
Upvote 0
If you did want to do it without a helper column, try this, It is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

Excel Workbook
ABC
1ValueToSortSorted
2512
3424
4935
5441
6453
7114612
81577
916789
101896
1115641013
121654118
13141210
141581311
15169411414
Sorted (2)
 
Upvote 0
If you did want to do it without a helper column, try this, It is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

Sorted (2)

ABC
1ValueToSortSorted
2512
3424
4935
5441
6453
7114612
81577
916789
101896
1115641013
121654118
13141210
141581311
15169411414

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:56px;"><col style="width:56px;"><col style="width:56px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
C2{=INDEX(B$2:B$15,MATCH(SMALL(RANK(A$2:A$15,A$2:A$15,1)+ROW(A$2:A$15)/10^6,ROWS(C$2:C2)),RANK(A$2:A$15,A$2:A$15,1)+ROW(A$2:A$15)/10^6,0))}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Peter_SSs,

Thank you, for your help. It finally solved my "bugs". Mixing my formula with yours I finally have what I wanted to achieve.
So thank you again. (I couldn't come with rank() Rank.EQ() Excel 2013).

-=LT=-
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,731
Members
448,987
Latest member
marion_davis

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