SOLVED

office 365 formula classificar

%3CLINGO-SUB%20id%3D%22lingo-sub-2820094%22%20slang%3D%22pt-BR%22%3Eoffice%20365%20formula%20sort%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2820094%22%20slang%3D%22pt-BR%22%3E%3CP%3EGood%20evening%20everyone%2C%20does%20anyone%20know%20how%20to%20make%20the%20formula%20rank%20only%20bring%20the%20first%203%20or%204%20information%20as%20if%20it%20were%20a%20ranking.%20When%20you%20make%20the%20sort%20formula%20in%20a%20table%20of%20400%20rows%20or%20more%20it%20brings%20all%20the%20information%20in%20order%20that%20I%20indicate%2C%20but%20only%20want%20some.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2820094%22%20slang%3D%22pt-BR%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2820602%22%20slang%3D%22en-US%22%3ERe%3A%20office%20365%20formula%20classificar%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2820602%22%20slang%3D%22en-US%22%3E%3CP%3EI%20assume%20you%20are%20using%20the%20SORT%20function%20to%20return%20your%20results.%20If%20so%2C%20consider%20wrapping%20it%20with%20the%20INDEX%20function.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20following%20formula%20returns%20the%20first%20four%20values%20returned%20by%20SORT%20in%20a%20column.%20If%20you%20want%20them%20returned%20as%20a%20row%2C%20use%20commas%20instead%20of%20semicolons%20in%20the%20array%20constant%20%7B1%3B2%3B3%3B4%7D.%20Formula%203%20using%20INDICE%20was%20produced%20using%20the%20Functions%20Translator%20Add-in%20using%20my%20USA%20formula%20as%20input%20and%20Portuguese%20as%20the%20output--I%20hope%20it%20has%20the%20list%20separators%20correct.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DINDEX(SORT(A2%3AA400%2C%2C1)%2C%7B1%3B2%3B3%3B4%7D)%0A%20%0A%3D%C3%8DNDICE(SORT(A2%3AA400%3B%3B1)%3B%7B1%3B2%3B3%3B4%7D)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2820761%22%20slang%3D%22en-US%22%3ERe%3A%20office%20365%20formula%20classificar%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2820761%22%20slang%3D%22en-US%22%3EInteresting%20add-in.%20My%20guess%20is%20that%201%20will%20create%20a%20column%20with%20English%20settings%2C%20whilst%203%20will%20produce%20a%20row%20with%20Portuguese%20settings.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2821618%22%20slang%3D%22pt-BR%22%3ERe%3A%20office%20365%20formula%20sort%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2821618%22%20slang%3D%22pt-BR%22%3E%3CP%3EI'm%20using%20the%20formula%20sortby.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2822968%22%20slang%3D%22en-US%22%3ERe%3A%20office%20365%20formula%20classificar%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2822968%22%20slang%3D%22en-US%22%3E%3CP%3EHere%20is%20the%20same%20approach%20using%20SORTBY.%20Note%20the%20use%20of%20curly%20braces%20surrounding%20the%20array%20constant%20%7B1%3B2%3B3%3B4%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3D%C3%8DNDEX(SORTBY(A2%3AA400%2CB2%3AB400)%2C%7B1%3B2%3B3%3B4%7D)%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BUSA%20Excel%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3D%C3%8DNDICE(SORTBY(A2%3AA400%3BB2%3AB400)%3B%7B1%3B2%3B3%3B4%7D)%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Portuguese%20Excel%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Boa noite a todos, alguém sabe como fazer com que a formula classificar apenas traga os 3 ou 4 primeiros informações como se fosse um ranking. Quando faz a formula classificar em uma tabela de 400 linhas ou mais ela traz todas as informações em ordem que eu indico, mas so quero algumas.

10 Replies

I assume you are using the SORT function to return your results. If so, consider wrapping it with the INDEX function.

 

The following formula returns the first four values returned by SORT in a column. If you want them returned as a row, use commas instead of semicolons in the array constant {1;2;3;4}. Formula 3 using INDICE was produced using the Functions Translator Add-in using my USA formula as input and Portuguese as the output--I hope it has the list separators correct.

=INDEX(SORT(A2:A400,,1),{1;2;3;4})
 
=ÍNDICE(SORT(A2:A400;;1);{1;2;3;4})

 

Interesting add-in. My guess is that 1 will create a column with English settings, whilst 3 will produce a row with Portuguese settings.

Estou usando a formula classificarpor.

Here is the same approach using SORTBY. Note the use of curly braces surrounding the array constant {1;2;3;4}

 

=ÍNDEX(SORTBY(A2:A400,B2:B400),{1;2;3;4})                USA Excel

 

=ÍNDICE(SORTBY(A2:A400;B2:B400);{1;2;3;4})               Portuguese Excel

entendi, pra mim a formula até funcionou, mas ela so tras a primeira coluna nao esta puxando o resto das informações.
Excel formulas do not work on "arrays of arrays" at the moment.

But you could copy across a formula that returns the top four in each column like:
=ÍNDEX(SORTBY(A2:A400,$B2:$B400),{1;2;3;4}) USA Excel

=ÍNDICE(SORTBY(A2:A400;$B2:$B400);{1;2;3;4}) Portuguese Excel

Microsoft added some new functions very recently to the Beta Channel of Microsoft 365. One of these functions is called MAKEARRAY, and can be used to return your results with a single formula in a single cell. It works with another recently added function LAMBDA, which lets you plug values into a formula.

 

As shown below, the formula returns a three column array of results for the top four rows returned by SORTBY function. I realize that you likely do not have the newly added functions, but am posting the suggestion because it was fun to figure out, and might be useful to somebody else in the future.

=MAKEARRAY(4,3,LAMBDA(r,c,INDEX(SORTBY(A2:C400,B2:B400),r,c)))

 

@byundt

Something that troubles me about the formula is that, at least from superficial examination, it would appear to be performing the sort over 400 rows 12 times (a good thing it is not 40,000 rows)..

A way of changing the appearance of the formula (for better or worse?) is to wrap it within LET, so allowing the Lambda function to be named. 

Refactoring such formulae is like picking one's path through an alligator swamp; 'nested arrays' and 'array of arrays' seem to lurk as errors just waiting to snap at the unwary.

best response confirmed by Guilherme_Garibaldi (Occasional Contributor)
Solution
Obrigado pela ajuda, funcionou, apenas preciso me entender com na fórmula, mas funciona.

Qual fórmula você escolheu e agora precisa entender como funciona?