Level 3QUERYProject, 8 min

A channel report from one QUERY

The task

Twelve campaigns across four channels. Build the report a marketing lead reads on Monday: spend and revenue by channel, ranked, with return on ad spend, and how many campaigns paid for themselves.
  1. Spend and revenue by channelIn G1, group by channel and total both spend and revenue: =QUERY(A1:E13, "select B, sum(C), sum(E) group by B")
  2. Rank it and name the columnsEdit G1: put the biggest revenue first and rename the sums. Add order by sum(E) desc label sum(C) 'Spend', sum(E) 'Revenue' to the end of the query.
  3. Return on ad spendIn J2, divide each channel's Revenue by its Spend, straight from the QUERY output: =ARRAYFORMULA(I2:I5/H2:H5).
  4. Which campaigns paid backIn H8, count the campaigns whose Revenue beat their Spend. FILTER the campaign names where E2:E13>C2:C13, then count them with COUNTA.

The data

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

ABCDEFGHIJ
1CampaignChannelSpendLeadsRevenueROAS
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,550Campaigns that paid back
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