sort index sequence function showing zero values first

valmir

Active Member
Joined
Feb 10, 2021
Messages
267
Office Version
  1. 365
Platform
  1. Windows
Hello everyone
I need help fixing this formula:
=SORT(INDEX(CG1#;SEQUENCE(ROWS(CG1#));{1\3\2});2;1)
As shown below, it is showing the zero values first on the alphabetically sorted column (middle column).
The sorting is supposed to start on row 24.
Thanks
Stats 2016 - Copy.xlsx
CSCTCU
1ASA0Ady ?
2BEN0Anderson
3PRO0Belito ?
44AB0Borra
54AB0Cadiata
64AB0Chara ?
7PLS0Chico Bel
8SAG0Didí
9PLS0Dji
104AB0Edi
11MAI0Fernandinho
12MAI0Isaías ?
134AB0Ivanilson
144AB0Jesse
15ASA0Kelly
164AB0Lara ?
17MAI0Mano ?
18PLS0Mayala
19POR0Miguel ?
20ACA0Nzuzi
214AB0Rui ?
22ASA0Tucho ?
23LIB0Yuri ?
24PLSAbel LukangoAbel
25DESAbelardo Gomes SocolaBelito Socola
26DESAbengea Mambani AliAli
27DESAdão Francisco Congo ZalataDadão Bile
28PRIAdão Joaquim Bango CabaçaTony Cabaça
29CAAAdelino Wima Calunhi AntónioManinho
30MAIAdérito Yandelela ChissocaLelas
31SAGAdérito Yandelela ChissocaLelas
32INTAdilson Cipriano da CruzNeblú
33LIBAdilson Ernesto KivãoAdilson Kivão
34CAAAdilson Joaquim ManuelAdilson Manuel
35PORAdolfo da Silva CatembaDenilson
36SAGAdolfo da Silva CatembaDenilson
37PROAdriano Belmiro Duarte NicolauYano
38DESAdriano da Costa Mateus AlbertoKumaca
39ASAAfonso Sebastião CabungulaFofó
STATS2
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I'm not exactly sure what you want, but maybe:

Excel Formula:
=IFERROR(SORT(INDEX(IF(CG1#=0;NA();CG1#);SEQUENCE(ROWS(CG1#));{1\3\2});2;1);"")
 
Upvote 0
=IFERROR(SORT(INDEX(IF(CG1#=0;NA();CG1#);SEQUENCE(ROWS(CG1#));{1\3\2});2;1);"")
Thank you sir, it moved those 23 empty rows to the bottom, now is it possible to eliminate them, please?
 
Upvote 0
Maybe
+Fluff 1.xlsm
GHIJKLMN
14ABBorra0PLSAbel LukangoAbel
24ABCadiata0DESAbelardo Gomes SocolaBelito Socola
34ABChara ?0DESAbengea Mambani AliAli
44ABEdi0DESAdão Francisco Congo ZalataDadão Bile
54ABIvanilson0PRIAdão Joaquim Bango CabaçaTony Cabaça
64ABJesse0CAAAdelino Wima Calunhi AntónioManinho
74ABLara ?0MAIAdérito Yandelela ChissocaLelas
84ABRui ?0SAGAdérito Yandelela ChissocaLelas
9ACANzuzi0INTAdilson Cipriano da CruzNeblú
10ASAAdy ?0LIBAdilson Ernesto KivãoAdilson Kivão
11ASAKelly0CAAAdilson Joaquim ManuelAdilson Manuel
12ASATucho ?0PORAdolfo da Silva CatembaDenilson
13ASAFofóAfonso Sebastião CabungulaSAGAdolfo da Silva CatembaDenilson
14BENAnderson0PROAdriano Belmiro Duarte NicolauYano
15CAAManinhoAdelino Wima Calunhi AntónioDESAdriano da Costa Mateus AlbertoKumaca
16CAAAdilson ManuelAdilson Joaquim ManuelASAAfonso Sebastião CabungulaFofó
17DESBelito SocolaAbelardo Gomes Socola
18DESAliAbengea Mambani Ali
19DESDadão BileAdão Francisco Congo Zalata
20DESKumacaAdriano da Costa Mateus Alberto
21INTNeblúAdilson Cipriano da Cruz
22LIBYuri ?0
23LIBAdilson KivãoAdilson Ernesto Kivão
24MAIFernandinho0
25MAIIsaías ?0
26MAIMano ?0
27MAILelasAdérito Yandelela Chissoca
28PLSChico Bel0
29PLSDji0
30PLSMayala0
31PLSAbelAbel Lukango
32PORMiguel ?0
33PORDenilsonAdolfo da Silva Catemba
34PRITony CabaçaAdão Joaquim Bango Cabaça
35PROBelito ?0
36PROYanoAdriano Belmiro Duarte Nicolau
37SAGDidí0
38SAGLelasAdérito Yandelela Chissoca
39SAGDenilsonAdolfo da Silva Catemba
Main
Cell Formulas
RangeFormula
G1:I39G1=INDEX(A1:C39,0,)
L1:N16L1=SORT(SORTBY(FILTER(G1#,INDEX(G1#,,3)<>0),{1,3,2}),2,1)
Dynamic array formulas.
 
Upvote 0
Maybe
+Fluff 1.xlsm
GHIJKLMN
14ABBorra0PLSAbel LukangoAbel
24ABCadiata0DESAbelardo Gomes SocolaBelito Socola
34ABChara ?0DESAbengea Mambani AliAli
44ABEdi0DESAdão Francisco Congo ZalataDadão Bile
54ABIvanilson0PRIAdão Joaquim Bango CabaçaTony Cabaça
64ABJesse0CAAAdelino Wima Calunhi AntónioManinho
74ABLara ?0MAIAdérito Yandelela ChissocaLelas
84ABRui ?0SAGAdérito Yandelela ChissocaLelas
9ACANzuzi0INTAdilson Cipriano da CruzNeblú
10ASAAdy ?0LIBAdilson Ernesto KivãoAdilson Kivão
11ASAKelly0CAAAdilson Joaquim ManuelAdilson Manuel
12ASATucho ?0PORAdolfo da Silva CatembaDenilson
13ASAFofóAfonso Sebastião CabungulaSAGAdolfo da Silva CatembaDenilson
14BENAnderson0PROAdriano Belmiro Duarte NicolauYano
15CAAManinhoAdelino Wima Calunhi AntónioDESAdriano da Costa Mateus AlbertoKumaca
16CAAAdilson ManuelAdilson Joaquim ManuelASAAfonso Sebastião CabungulaFofó
17DESBelito SocolaAbelardo Gomes Socola
18DESAliAbengea Mambani Ali
19DESDadão BileAdão Francisco Congo Zalata
20DESKumacaAdriano da Costa Mateus Alberto
21INTNeblúAdilson Cipriano da Cruz
22LIBYuri ?0
23LIBAdilson KivãoAdilson Ernesto Kivão
24MAIFernandinho0
25MAIIsaías ?0
26MAIMano ?0
27MAILelasAdérito Yandelela Chissoca
28PLSChico Bel0
29PLSDji0
30PLSMayala0
31PLSAbelAbel Lukango
32PORMiguel ?0
33PORDenilsonAdolfo da Silva Catemba
34PRITony CabaçaAdão Joaquim Bango Cabaça
35PROBelito ?0
36PROYanoAdriano Belmiro Duarte Nicolau
37SAGDidí0
38SAGLelasAdérito Yandelela Chissoca
39SAGDenilsonAdolfo da Silva Catemba
Main
Cell Formulas
RangeFormula
G1:I39G1=INDEX(A1:C39,0,)
L1:N16L1=SORT(SORTBY(FILTER(G1#,INDEX(G1#,,3)<>0),{1,3,2}),2,1)
Dynamic array formulas.
Dear Sir
Is there another solution even with another formula? Basically what I am trying to accomplish is to make the three source columns (A,B,C) into the three target columns (D,E,F). Source column C becomes column E (alphabetically sorted) with its corresponding matches. Please note that empty values in B and C should not appear.
Please take a look at source and desired target
Stats 2016 - Copy.xlsx
ABCDEF
14ABBorra0PLSAbel LukangoAbel
24ABCadiata0DESAbelardo Gomes SocolaBelito Socola
34ABCamposAntónio Campos CaleiDESAbengea Mambani AliAli
44ABChara ?0DESAdão Francisco Congo ZalataDadão Bile
54ABDany RibeiroDaniel Mendes RibeiroPRIAdão Joaquim Bango CabaçaTony Cabaça
64ABDário AmorimDário Félix AmorimCAAAdelino Wima Calunhi AntónioManinho
7ACAAdó PenaAntónio Joaquim Barros PenaMAIAdérito Yandelela ChissocaLelas
8ACAAiresLudgero Aires Cachicote da RochaSAGAdérito Yandelela ChissocaLelas
9ACABorgesCláudio Ricardo Cunha BorgesINTAdilson Cipriano da CruzNeblú
10ACACabibi AbreuMário Rui de AbreuLIBAdilson Ernesto KivãoAdilson Kivão
11ACACamotaJúlio Camota Marcelino TitoCAAAdilson Joaquim ManuelAdilson Manuel
12ACAChabalalaGaspar Necas FortunatoPORAdolfo da Silva CatembaDenilson
13BENAmaroAmândio Manuel Filipe da CostaSAGAdolfo da Silva CatembaDenilson
14BEN0PROAdriano Belmiro Duarte NicolauYano
15BENAmido BaldéAmido BaldéDESAdriano da Costa Mateus AlbertoKumaca
16BENAnderson0ASAAfonso Sebastião CabungulaFofó
17BENBabyValdemar Denso AntónioINTAgostinho Cristóvão PaciênciaMabululu
18BENBenaDiveluca Simão NascimentoBENAgostinho Domingos PauloAdy Paulo
19BENBorgesCláudio Ricardo Cunha BorgesKABAires Emilson Gonzaga ZecaEmilson
20BENDebeleEdgar Elias Hebo KissangaMAIAlbano Camuele SumanoPai da Bola
STATS2
Cell Formulas
RangeFormula
B1B1=INDIRECT("4AB!B5")
C1C1=INDIRECT("4AB!C5")
B2B2=INDIRECT("4AB!B6")
C2C2=INDIRECT("4AB!C6")
B3B3=INDIRECT("4AB!B7")
C3C3=INDIRECT("4AB!C7")
B4B4=INDIRECT("4AB!B8")
C4C4=INDIRECT("4AB!C8")
B5B5=INDIRECT("4AB!B9")
C5C5=INDIRECT("4AB!C9")
B6B6=INDIRECT("4AB!B10")
C6C6=INDIRECT("4AB!C10")
 
Upvote 0
Doesn't the formula I showed in L1 do that for you?
 
Upvote 0
Doesn't the formula I showed in L1 do that for you?
In this case I will have a repetition of columns G, H and I? Because I already have those as the source columns. Can you please make me understand?
 
Upvote 0
You originally posted a formula that looks at a spill range & asked for it to be modified, which Eric & I have done.
If that is not what you wanted, then why did you ask?
 
Upvote 0
Doesn't the formula I showed in L1 do that for you?

You originally posted a formula that looks at a spill range & asked for it to be modified, which Eric & I have done.
If that is not what you wanted, then why did you ask?
If you notice, that's exactly what I asked. Eric's solution solved part of the problem, it didn't eliminate the empty rows, it moved them to the bottom, your solution, on the other hand, requires having a repetition of the three columns, which I don't want, if I understood well your solution. I was thinking that it would be easier for you guys to "fix" that formula, otherwise, if there was an easier or more direct way of doing it, come up with another formula. That's the only reason why I showed you the source and target columns, maybe for you to better understand what I want.
 
Upvote 0
My solution works on the spilled range that your formula works on.
I created some scrap data in G1 to represent your data in CG1 & then the formula in L1 is to replace the formula you posted in your op.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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