Level 3QUERYPractice, 4 min

QUERY: top channels with labels

The task

In G1, show the two channels with the most leads, with their spend, and readable headers: =QUERY(A1:E13, "select B, sum(D), sum(C) group by B order by sum(D) desc limit 2 label sum(D) 'Leads', sum(C) 'Spend'")

The data

The starting sheet. Cells outlined in green are where your formulas go.

ABCDEFG
1CampaignChannelSpendLeadsRevenue
2Brand termsPaid Search$2,40096$14,400
3Competitor termsPaid Search$3,10041$2,950
4Product termsPaid Search$5,20088$17,600
5Prospecting videoPaid Social$4,60052$3,980
6Lookalike 1%Paid Social$3,80061$9,120
7RetargetingPaid Social$1,90047$8,550
8Webinar promoEmail$60073$4,380
9NewsletterEmail$25022$1,750
10Win-backEmail$40018$3,240
11Display remarketingDisplay$1,70023$2,890
12ContextualDisplay$2,20014$1,430
13YouTubeDisplay$3,30019$2,310