1

I have data that I want to sort in my google sheets; but I want to show only specific columns and not others.

Here's an example :

Name Type HP ATK
Hero1 type1 10 5
Hero2 type1 9 8
Hero3 type2 [null] 7
Hero4 type2 11 6

After a =SORT() in an other sheet; I'd like to have something like this :

Name HP
Hero4 11
Hero1 10
Hero2 9

And with an other =SORT() have this :

Name ATK
Hero2 8
Hero3 7
Hero4 6
Hero1 5

I tried with FILTER() But I can't manage to get rid of the Type column

Of course I don't want to modify the first table

But I could use sorted tables containing only the name and not wathever value was used to sort them

EDIT : Test image

Neo
  • 525
  • 3
  • 17

3 Answers3

2

One

=QUERY({A:D};"Select Col1,Col4 where Col1 <> '' Order by Col4 desc";1)

Two

=QUERY({A:D};"Select Col1,Col3 where Col1 <> '' Order by Col3 desc";1)

enter image description here

QUERY

Osm
  • 2,699
  • 2
  • 4
  • 26
2

You can create a virtual array {A2:A,D2:D} and use

=SORT({A2:A,D2:D},2,0)

or even

=SORT({A2:A,C2:C},2,0)

(Do adjust the formula according to your ranges and locale)

In your case it would be:

=SORT({A2:A\D2:D};2;0)

enter image description here

marikamitsos
  • 10,264
  • 20
  • 26
1

use:

=SORT(FILTER({A2:A\C2:C}; C2:C<>""); 2; )

enter image description here

and:

=SORT(FILTER({A2:A\D2:D}; D2:D<>""); 2; )

enter image description here

pros: SORT with FILTER is faster and more reliable than QUERY that can eat your data

also, see how to convert commas to semicolons: https://stackoverflow.com/a/73767720/5632629

player0
  • 124,011
  • 12
  • 67
  • 124