Home

Sorting col large to small with duplicates and putting into a vertical table

%3CLINGO-SUB%20id%3D%22lingo-sub-481359%22%20slang%3D%22en-US%22%3ESorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481359%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20sort%20the%20horizonal%20values%20in%20the%20first%20row%20based%20upon%20the%20values%20in%20the%20second%20row%20and%20have%20the%20result%20be%20similar%20to%20the%20vertical%20table%20to%20the%20right%3C%2FP%3E%3CP%3EI%20keep%20getting%20%23num%20or%20it%20only%20returns%20one%20value%26nbsp%3B%3C%2FP%3E%3CP%3EI%20had%20so%20many%20formulas%20I%20tried%20I%20am%20not%20putting%20them%20up%20so%20this%20is%20a%20blank%20slate%20for%20the%20formula%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-481359%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481863%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481863%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20the%20attached%20file%2C%20these%20are%20my%20formulas%3A%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20Q1%2C%20copied%20across%20to%20U1%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3DINDEX(%24A10%3A%24A14%2C%3CBR%20%2F%3ECOLUMN()-16)%3C%2FP%3E%3CP%3E2.%20P2%2C%20copied%20down%20rows%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(ROW()-1%26gt%3BCOUNT(%24B%2410%3A%24N%2410)%2C%22%22%2C%3CBR%20%2F%3ELOOKUP(2%2C1%2F(%24B%2410%3A%24N%2410*(COUNTIF(P%241%3AP1%2C%24B%249%3A%24N%249)%3D0)%3DMAX(INDEX(%3CBR%20%2F%3E%24B%2410%3A%24N%2410*(COUNTIF(P%241%3AP1%2C%24B%249%3A%24N%249)%3D0)%2C0)))%2C%3CBR%20%2F%3E%24B%249%3A%24N%249))%3C%2FP%3E%3CP%3E3.%20Q2%2C%20copied%20down%20rows%20and%20across%20to%20Column%20U%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(%24P2%3D%22%22%2C%22%22%2C%3CBR%20%2F%3EHLOOKUP(%24P2%2C%24B%249%3A%24N%2414%2C%3CBR%20%2F%3ECOLUMN()-15%2C0))%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481605%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481605%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F322032%22%20target%3D%22_blank%22%3E%40Dichotomy66%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnswered%20from%20mobile%20previous%20time%2C%20open%20the%20computer%20and%20didn't%20catch%20how%20row%2012%20(RA)%20affects%20the%20Total%20(row%2010)%20and%20what%20they%20shall%20be.%20Anyway%2C%20I%20reworked%20the%20formula%20to%20avoid%20helper%20column%20as%3C%2FP%3E%0A%3CPRE%3E%3DIFERROR(%0A%20%20%20INDEX(%24B%249%3A%24N%249%2C1%2C%0A%20%20%20%20%20%20AGGREGATE(14%2C6%2C%0A%20%20%20%20%20%20%20%20%201%2F(%24B%2410%3A%24N%2410%3DAGGREGATE(14%2C6%2C%24B%2410%3A%24N%2410%2CROW()-ROW(%24P%241)))*%0A%20%20%20%20%20%20%20%20%20%20%20%20COLUMN(%24B%2410%3A%24N%2410)%2C%0A%20%20%20%20%20%20SUMPRODUCT(--(%24B%2410%3A%24N%2410%3DAGGREGATE(14%2C6%2C%24B%2410%3A%24N%2410%2CROW()-1))))-COLUMN(%24A%2410))%2C%0A%22%22)%3C%2FPRE%3E%0A%3CP%3Eand%20now%20it%20shall%20not%20depend%20on%20which%20numbers%20are%20in%20Total%20row.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20again%20something%20is%20wrong%20please%20attach%20sample%20file%20there%20the%20issue%20is%2C%20from%20the%20text%20it's%20bit%20hard%20to%20understand%20without%20the%20knowledge%20what%20is%20behind%20your%20figures.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481545%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481545%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F322032%22%20target%3D%22_blank%22%3E%40Dichotomy66%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYes%2C%20I%20assumed%20they%20are%20integers.%20Will%20correct%20in%20some%20while.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481518%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481518%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20switched%20the%20values%20in%20row%2012%20to%20just%20numbers%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3ERA%3C%2FTD%3E%3CTD%3E0.00%3C%2FTD%3E%3CTD%3E0.00%3C%2FTD%3E%3CTD%3E0.00%3C%2FTD%3E%3CTD%3E16.67%3C%2FTD%3E%3CTD%3E50.00%3C%2FTD%3E%3CTD%3E60.00%3C%2FTD%3E%3CTD%3E0.00%3C%2FTD%3E%3CTD%3E36.36%3C%2FTD%3E%3CTD%3E66.67%3C%2FTD%3E%3CTD%3E28.57%3C%2FTD%3E%3CTD%3E0.00%3C%2FTD%3E%3CTD%3E0.00%3C%2FTD%3E%3CTD%3E0.00%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3ENow%20when%20I%20run%20the%20helper%20column%20the%20zeroes%20give%20big%20numbers%20that%20lead%20to%20blanks%20in%20the%20results%20column%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E696%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E23%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E22%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E385%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E597%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E691%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E24%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E20%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E19%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E18%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CTABLE%20border%3D%220%22%20cellspacing%3D%220%22%20cellpadding%3D%220%22%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CFONT%20color%3D%22%23000000%22%20face%3D%22Calibri%22%3EMHH%3C%2FFONT%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CFONT%20color%3D%22%23000000%22%20face%3D%22Calibri%22%3EMMH%3C%2FFONT%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CFONT%20color%3D%22%23000000%22%20face%3D%22Calibri%22%3EHHH%3C%2FFONT%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CFONT%20color%3D%22%23000000%22%20face%3D%22Calibri%22%3ELHH%3C%2FFONT%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CFONT%20color%3D%22%23000000%22%20face%3D%22Calibri%22%3ELMH%3C%2FFONT%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CFONT%20color%3D%22%23000000%22%20face%3D%22Calibri%22%3ELMM%3C%2FFONT%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3EThere%20may%20be%20no%20real%20way%20to%20do%20this%20but%20RA%20stands%20for%20advantage%20RN%20neutral%20and%20RD%20disadvantage%3C%2FP%3E%3CP%3EIf%20I%20could%20somehow%20have%20the%20results%20column%20sort%20row9%20such%20that%20first%20from%20large%20to%20small%20was%20the%20ones%20where%20RA%20was%20over%2050%20then%20the%20ones%20where%20RN%20was%20greater%20than%20RD%20followed%20by%20RN%3DRD%20and%20lastly%20RD%20sorted%26nbsp%3B%20so%20the%20result%20would%20in%20this%20case%20be%26nbsp%3B%3C%2FP%3E%3CP%3EMHH%20LHH%20LMH%20LMM%20HHH%20MMH%20LLH%20MMM%20LLL%20LLM%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481463%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481463%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%2C%20I%20used%20this%20to%20check%20if%20%22traditional%22%20formulas%20are%20correct...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481457%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481457%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F322032%22%20target%3D%22_blank%22%3E%40Dichotomy66%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20futures%20but%20a%20simple%20solution%20is%20coming%20to%20a%20computer%20near%20you!%3C%2FP%3E%3CP%3EUsing%20modern%20Dynamic%20Arrays%20the%20formula%20in%20cell%20Q2%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20855px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F110018iC27DA59A97F35C37%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture.JPG%22%20title%3D%22Capture.JPG%22%20%2F%3E%3C%2FSPAN%3Ewill%20be%3C%2FP%3E%3CP%3E%3D%20SORT(%20TRANSPOSE(data)%2C%202%2C%20-1%20)%3C%2FP%3E%3CP%3EI%20will%20be%20so%20thankful%20to%20get%20rid%20of%20direct%20cell%20referencing%20and%20the%20practice%20of%20filling%20down%20single-cell%20formulas%20when%20a%20simple%20array%20is%20all%20that%20is%20needed!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481445%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481445%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F322032%22%20target%3D%22_blank%22%3E%40Dichotomy66%3C%2FA%3E%26nbsp%3B%2C%20you%20are%20welcome%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481421%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481421%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3EThanks%20that%20will%20work%20and%20luckily%20I%20have%20a%20place%20to%20hide%20the%20helper%20column%20close%20by%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481390%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481390%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F322032%22%20target%3D%22_blank%22%3E%40Dichotomy66%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20may%20first%20create%20helper%20column%20to%20find%20the%20positions%20with%20with%20the%20large%20to%20small%20in%20totals%20(in%20P2)%3C%2FP%3E%0A%3CPRE%3E%3DIFERROR((AGGREGATE(14%2C6%2C%24B%2410%3A%24N%2410*1000%2BCOLUMN(%24B%249%3A%24N%249)%2CROW()-ROW(%24P%241))%2F1000-INT(AGGREGATE(14%2C6%2C%24B%2410%3A%24N%2410*1000%2BCOLUMN(%24B%249%3A%24N%249)%2CROW()-ROW(%24P%241))%2F1000))*1000%2C%22%22)%3C%2FPRE%3E%0A%3CP%3Ebased%20on%20that%20position%20you%20may%20select%20values%20from%20other%20rows%20like%3C%2FP%3E%0A%3CPRE%3E%3DIFERROR(INDEX(%24B%249%3A%24N%249%2C0%2C%24P2-COLUMN(%24A%249))%2C%22%22)%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20583px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F110001i732F15C71BE29139%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EDrag%20the%20all%20down%20till%20first%20empty%20cells%20appear.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-501939%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-501939%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESO%20here%20is%20the%20solution%20I%20came%20up%20with%20in%20the%20end%3C%2FP%3E%3CP%3EIN%20the%20Data%20set%20I%20added%20an%20infintessimal%3C%2FP%3E%3CP%3Eex.%26nbsp%3B%3D(COUNTIF(TYPERN%2CBG%2410)%2FBG%2411)%2B(1%2F(COLUMN()*10%5E5))%3C%2FP%3E%3CP%3EThen%20I%20created%204%20conditional%20helper%20columns%20to%20sort%20and%20return%20column%20numbers%3C%2FP%3E%3CP%3EHelper%201%20The%20Best%3C%2FP%3E%3CP%3E%3DIFERROR(MATCH(LARGE(IF((%24BC%2413%3A%24BL%2413%26gt%3B%3D0.5)%2C%24BC%2413%3A%24BL%2413%2C%22glo%22)%2CROWS(%24T%242%3A%24T2))%2C%24BC%2413%3A%24BL%2413%2C0)%2C%22%22)%3C%2FP%3E%3CP%3E%26nbsp%3BHelper%202%20The%20good%3C%2FP%3E%3CP%3E%3DIFERROR(MATCH(LARGE(IFS((%24BC%2413%3A%24BL%2413%26lt%3B0.5)*(%24BC%2413%3A%24BL%2413%26gt%3B%24BC%2414%3A%24BL%2414)*(%24BC%2413%3A%24BL%2413%26gt%3B%24BC%2415%3A%24BL%2415)%2C%24BC%2414%3A%24BL%2414%2C(%24BC%2414%3A%24BL%2414%26gt%3B%3D%24BC%2413%3A%24BL%2413)*(%24BC%2414%3A%24BL%2414%26gt%3B%24BC%2415%3A%24BL%2415)%2C%24BC%2414%3A%24BL%2414%2C(%24BC%2414%3A%24BL%2414%3D%24BC%2413%3A%24BL%2413%3D%24BC%2415%3A%24BL%2415)%2C%24BC%2414%3A%24BL%2414%2CTRUE%2C%22%22)%2CROWS(%24U%242%3A%24U2))%2C%24BC%2414%3A%24BL%2414%2C0)%2C%22%22)%3C%2FP%3E%3CP%3EHelper%203%20the%20not%20so%20good%3C%2FP%3E%3CP%3E%3DIFERROR(MATCH(LARGE(IF((%24BC%2414%3A%24BL%2414%3D%24BC%2415%3A%24BL%2415)*(%24BC%2414%3A%24BL%2414%26gt%3B%24BC%2413%3A%24BL%2413)%2C%24BC%2414%3A%24BL%2414)%2CROWS(%24V%242%3A%24V2))%2C%24BC%2414%3A%24BL%2414%2C0)%2C%22%22)%3C%2FP%3E%3CP%3EHelper%204%20I%20ranked%20them%20with%20small%20so%20the%20worst%20appear%20at%20the%20bottom%20of%20the%20list%3C%2FP%3E%3CP%3E%3DMATCH(SMALL(%24BC%2415%3A%24BL%2415%2CROWS(%24W%242%3A%24W2))%2C%24BC%2415%3A%24BL%2415%2C0)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESO%20the%20first%203%20columns%20only%20have%20a%20few%20to%20zero%20values%3C%2FP%3E%3CP%3EThen%20I%20used%20this%20formula%20in%20my%20results%20column%3C%2FP%3E%3CP%3E%3DIFERROR(INDEX(%24BC%2410%3A%24BL%2410%2C%2C(INDIRECT(ADDRESS(ROW()%2C20))))%2C(IFERROR(INDEX(%24BC%2410%3A%24BL%2410%2C%2C(INDIRECT(ADDRESS((ROW()-(COUNT(%24T%242%3A%24T%2411)))%2C21))))%2C(IFERROR(INDEX(%24BC%2410%3A%24BL%2410%2C%2C(INDIRECT(ADDRESS(((ROW())-(COUNT(%24T%242%3A%24T%2411))-(COUNT(%24U%242%3A%24U%2411)))%2C22))))%2C(INDEX(%24BC%2410%3A%24BL%2410%2C%2C(INDIRECT(ADDRESS(ROW()%2C23))))))))))%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20returned%20the%20values%20based%20on%20the%20column%20number%20in%20the%20helpers%20and%20ranked%20the%20results%20from%20best%20to%20worst%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-503316%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-503316%22%20slang%3D%22en-US%22%3EI%20guess%20you%20have%20not%20yet%20looked%20into%20the%20formulas%20I%20suggested%20in%20the%20file%20I%20attached%20earlier.%20Please%20do%20and%20inform%20me%20of%20your%20thoughts%20thereon.%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-503476%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-503476%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F322032%22%20target%3D%22_blank%22%3E%40Dichotomy66%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20had%20a%20go%20at%20using%20my%20normal%20methods%20(pre-dynamic%20arrays)%20but%20with%20limited%20success.%3C%2FP%3E%3CP%3EBecause%20I%20used%20COUNTIFS%20to%20rank%20the%20terms%2C%20I%20had%20to%20introduce%20a%20helper%20row%20as%20the%20criterion%20range.%26nbsp%3B%20The%20formula%20I%20used%20for%20the%20'criteria'%20range%20was%3C%2FP%3E%3CP%3E%3D%20100*(RA%26gt%3B50)%20%2B%2010*(RN%26gt%3BRD)%20%2B%20(RN%3DRD)%3C%2FP%3E%3CP%3E%5Busing%20a%20decimal%20place%20for%20each%20discrete%20sub-criterion%5D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20formula%20for%20ranking%20the%20terms%20by%20the%20criteria%20was%3C%2FP%3E%3CP%3E%3D%201%20%2B%3C%2FP%3E%3CP%3ECOUNTIFS(Criteria%2C%20%22%26gt%3B%22%26amp%3BCriteria)%20%2B%3C%2FP%3E%3CP%3ECOUNTIFS(RD%2C%22%26gt%3B%22%26amp%3BRD%2C%20Criteria%2C%20Criteria)%20%2B%3C%2FP%3E%3CP%3ECOUNTIFS(%20k%2C%20%22%26lt%3B%22%26amp%3Bk%2C%20Criteria%2C%20Criteria%2C%20RD%2C%20RD%20)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20place%20the%20results%20in%20rank%20order%20and%20transpose%2C%20I%20defined%20'pointer'%20to%20be%3C%2FP%3E%3CP%3E%3D%20MATCH(%20TRANSPOSE(k)%2C%20rank%2C%200)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20just%20leaves%20an%20array%20formula%20to%20output%20the%20result%3C%2FP%3E%3CP%3E%3D%20INDEX(%20Code%2C%20pointer%20)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20guess%20this%20doesn't%20look%20much%20like%20other%20people's%20solutions%20but%20it%20is%20still%20valid%20Excel%20and%20is%20about%20to%20get%20so%20much%20easier%20with%20modern%20dynamic%20arrays.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-503905%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-503905%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3EI%20looked%20but%20your%20results%20didn't%20sort%20the%20subset%20results.%20And%20I%20couldnt%20see%20a%20simple%20way%20to%20modify%20this...%20The%20primary%20end%20goal%20is%20to%20have%20the%20LLL-HHH%20Values%20sorted%20from%20best%20to%20worst%20based%20on%20the%20criteria.%20I%20don't%20need%20or%20want%20any%20of%20the%20other%20data%20from%20the%20originating%20table%20transposed%20also.%20IN%20your%20results%20the%20one%20that%20was%20%5E*%25%20RA%20ended%20up%20down%20a%20ways%20instead%20of%20at%20the%20top%20for%20ex%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-504012%22%20slang%3D%22en-US%22%3ERe%3A%20Sorting%20col%20large%20to%20small%20with%20duplicates%20and%20putting%20into%20a%20vertical%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-504012%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F322032%22%20target%3D%22_blank%22%3E%40Dichotomy66%3C%2FA%3EThis%20picture%20shows%20my%20final%20results%20with%20the%20helper%20columns%20to%20the%20left.%20The%20numbers%20to%20the%20right%20of%20the%20colored%20columns%20are%20generated%20from%20a%20totally%20different%20table%20than%20the%20one%20is%20this%20problem.After%20getting%20the%20sorts%20done%20I%20then%20used%20conditional%20formatting%20to%20get%20the%20color%20indicators.%20I%20have%20tested%20it%20now%20with%203%20different%20data%20sets%20of%20varying%20size%20and%20works%20great%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20768px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111128iE6C481F47DB2F03D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture.PNG%22%20title%3D%22Capture.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Dichotomy66
Contributor

I am trying to sort the horizonal values in the first row based upon the values in the second row and have the result be similar to the vertical table to the right

I keep getting #num or it only returns one value 

I had so many formulas I tried I am not putting them up so this is a blank slate for the formula

14 Replies

@Dichotomy66 ,

 

You may first create helper column to find the positions with with the large to small in totals (in P2)

=IFERROR((AGGREGATE(14,6,$B$10:$N$10*1000+COLUMN($B$9:$N$9),ROW()-ROW($P$1))/1000-INT(AGGREGATE(14,6,$B$10:$N$10*1000+COLUMN($B$9:$N$9),ROW()-ROW($P$1))/1000))*1000,"")

based on that position you may select values from other rows like

=IFERROR(INDEX($B$9:$N$9,0,$P2-COLUMN($A$9)),"")

image.png

Drag the all down till first empty cells appear.

@Sergei BaklanThanks that will work and luckily I have a place to hide the helper column close by

@Dichotomy66 

This is futures but a simple solution is coming to a computer near you!

Using modern Dynamic Arrays the formula in cell Q2

Capture.JPGwill be

= SORT( TRANSPOSE(data), 2, -1 )

I will be so thankful to get rid of direct cell referencing and the practice of filling down single-cell formulas when a simple array is all that is needed!

 

@Peter Bartholomew , I used this to check if "traditional" formulas are correct...

@Sergei Baklan 

I switched the values in row 12 to just numbers

RA0.000.000.0016.6750.0060.000.0036.3666.6728.570.000.000.00

Now when I run the helper column the zeroes give big numbers that lead to blanks in the results column

 
696
23
22
385
597
691
24
20
19
18
 
 
MHH
MMH
 
 
 
HHH
LHH
LMH
LMM
 
 

There may be no real way to do this but RA stands for advantage RN neutral and RD disadvantage

If I could somehow have the results column sort row9 such that first from large to small was the ones where RA was over 50 then the ones where RN was greater than RD followed by RN=RD and lastly RD sorted  so the result would in this case be 

MHH LHH LMH LMM HHH MMH LLH MMM LLL LLM

 

@Dichotomy66 

 

Yes, I assumed they are integers. Will correct in some while.

@Dichotomy66 

 

Answered from mobile previous time, open the computer and didn't catch how row 12 (RA) affects the Total (row 10) and what they shall be. Anyway, I reworked the formula to avoid helper column as

=IFERROR(
   INDEX($B$9:$N$9,1,
      AGGREGATE(14,6,
         1/($B$10:$N$10=AGGREGATE(14,6,$B$10:$N$10,ROW()-ROW($P$1)))*
            COLUMN($B$10:$N$10),
      SUMPRODUCT(--($B$10:$N$10=AGGREGATE(14,6,$B$10:$N$10,ROW()-1))))-COLUMN($A$10)),
"")

and now it shall not depend on which numbers are in Total row.

 

If again something is wrong please attach sample file there the issue is, from the text it's bit hard to understand without the knowledge what is behind your figures.

In the attached file, these are my formulas: 

1. Q1, copied across to U1: 

=INDEX($A10:$A14,
COLUMN()-16)

2. P2, copied down rows: 

=IF(ROW()-1>COUNT($B$10:$N$10),"",
LOOKUP(2,1/($B$10:$N$10*(COUNTIF(P$1:P1,$B$9:$N$9)=0)=MAX(INDEX(
$B$10:$N$10*(COUNTIF(P$1:P1,$B$9:$N$9)=0),0))),
$B$9:$N$9))

3. Q2, copied down rows and across to Column U: 

=IF($P2="","",
HLOOKUP($P2,$B$9:$N$14,
COLUMN()-15,0))

@Sergei Baklan 

SO here is the solution I came up with in the end

IN the Data set I added an infintessimal

ex. =(COUNTIF(TYPERN,BG$10)/BG$11)+(1/(COLUMN()*10^5))

Then I created 4 conditional helper columns to sort and return column numbers

Helper 1 The Best

=IFERROR(MATCH(LARGE(IF(($BC$13:$BL$13>=0.5),$BC$13:$BL$13,"glo"),ROWS($T$2:$T2)),$BC$13:$BL$13,0),"")

 Helper 2 The good

=IFERROR(MATCH(LARGE(IFS(($BC$13:$BL$13<0.5)*($BC$13:$BL$13>$BC$14:$BL$14)*($BC$13:$BL$13>$BC$15:$BL$15),$BC$14:$BL$14,($BC$14:$BL$14>=$BC$13:$BL$13)*($BC$14:$BL$14>$BC$15:$BL$15),$BC$14:$BL$14,($BC$14:$BL$14=$BC$13:$BL$13=$BC$15:$BL$15),$BC$14:$BL$14,TRUE,""),ROWS($U$2:$U2)),$BC$14:$BL$14,0),"")

Helper 3 the not so good

=IFERROR(MATCH(LARGE(IF(($BC$14:$BL$14=$BC$15:$BL$15)*($BC$14:$BL$14>$BC$13:$BL$13),$BC$14:$BL$14),ROWS($V$2:$V2)),$BC$14:$BL$14,0),"")

Helper 4 I ranked them with small so the worst appear at the bottom of the list

=MATCH(SMALL($BC$15:$BL$15,ROWS($W$2:$W2)),$BC$15:$BL$15,0)

 

SO the first 3 columns only have a few to zero values

Then I used this formula in my results column

=IFERROR(INDEX($BC$10:$BL$10,,(INDIRECT(ADDRESS(ROW(),20)))),(IFERROR(INDEX($BC$10:$BL$10,,(INDIRECT(ADDRESS((ROW()-(COUNT($T$2:$T$11))),21)))),(IFERROR(INDEX($BC$10:$BL$10,,(INDIRECT(ADDRESS(((ROW())-(COUNT($T$2:$T$11))-(COUNT($U$2:$U$11))),22)))),(INDEX($BC$10:$BL$10,,(INDIRECT(ADDRESS(ROW(),23))))))))))

 

This returned the values based on the column number in the helpers and ranked the results from best to worst

I guess you have not yet looked into the formulas I suggested in the file I attached earlier. Please do and inform me of your thoughts thereon.

@Dichotomy66 

I had a go at using my normal methods (pre-dynamic arrays) but with limited success.

Because I used COUNTIFS to rank the terms, I had to introduce a helper row as the criterion range.  The formula I used for the 'criteria' range was

= 100*(RA>50) + 10*(RN>RD) + (RN=RD)

[using a decimal place for each discrete sub-criterion]

 

The formula for ranking the terms by the criteria was

= 1 +

COUNTIFS(Criteria, ">"&Criteria) +

COUNTIFS(RD,">"&RD, Criteria, Criteria) +

COUNTIFS( k, "<"&k, Criteria, Criteria, RD, RD )

 

To place the results in rank order and transpose, I defined 'pointer' to be

= MATCH( TRANSPOSE(k), rank, 0)

 

That just leaves an array formula to output the result

= INDEX( Code, pointer )

 

I guess this doesn't look much like other people's solutions but it is still valid Excel and is about to get so much easier with modern dynamic arrays.

@TwifooI looked but your results didn't sort the subset results. And I couldnt see a simple way to modify this... The primary end goal is to have the LLL-HHH Values sorted from best to worst based on the criteria. I don't need or want any of the other data from the originating table transposed also. IN your results the one that was ^*% RA ended up down a ways instead of at the top for ex

 

 

@Dichotomy66This picture shows my final results with the helper columns to the left. The numbers to the right of the colored columns are generated from a totally different table than the one is this problem.After getting the sorts done I then used conditional formatting to get the color indicators. I have tested it now with 3 different data sets of varying size and works great

Capture.PNG

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
IIS extension is not working - WAC 1909
HotCakeX in Windows Admin Center on
11 Replies