2

Thanks in advance for any help. So here’s my dilemma, this is an example (copy) of a Google sheet with raw data in first tab and I’m trying to extract summary data onto the second tab.

https://docs.google.com/spreadsheets/d/1IRlq-1cVaW1thzH8_c0nqNIJlLykaenJIO67RrS7kQE/edit?usp=sharing

I’ve done it via a Google sheets Pivot Table - it’s supposed to rank the people who have done the most miles in descending order, taken from the main Data tab (i.e. the highest number of miles first). The problem is that for some odd reason, when it hits someone with the same first name, it groups them and it messes up the descending order (see James McLeod then James Stringer as an example).

On the main sheet, as an alternative method, I’ve been experimenting with their QUERY function which is very powerful and should do the the job. You can see examples of these in the first results tab on the right side starting at cell H1. I have named the data from columns A:F as a range called "Results"

The query in H1 is almost right but it won’t let me add first name and role column which I need (as per the Pivot Table example). I need to include First Name, Last Name, Role and the total distance they have achieved, sorted by highest to lowest distance.

Eventually this summary data needs to be on a new tab anyway

Thank you, any help would be most appreciated!

player0
  • 124,011
  • 12
  • 67
  • 124

2 Answers2

1

try:

=QUERY(Results, "select B,C,D,sum(F) group by B,C,D order by sum(F) desc", 1)

0

player0
  • 124,011
  • 12
  • 67
  • 124
  • 1
    Dear player0 - thank you SO SO MUCH, this is a perfect solution and just what I was looking for. I spent ages trying to make this work, really appreciate it THANKS!!! – David Kelly Jan 10 '20 at 09:29
0

Without query you can use filter, unique, sort like this:

={Data!B1:D1,"Sum of distance";unique(filter(sort({Data!B2:D, sumif(Data!B2:B & Data!C2:C,"=" & Data!B2:B & Data!C2:C,Data!F2:F)},4,false,1,true),Data!B2:B <>""))}
user11982798
  • 1,878
  • 1
  • 6
  • 8
  • 1
    Thank you very much for this alternate way to do it, really appreciated! now I have two workable solutions, THANKS – David Kelly Jan 10 '20 at 09:30