How to Make Numbered Raffle Tickets from Google Sheets: Tickets with Matching Stubs, Seller Ticket Books and a Sales Tracker (2026)

A school, church, club or charity raffle usually runs on paper: a few hundred numbered tickets, each with a stub, split into books for the people selling them. The hard part isn’t the design, it’s the bookkeeping afterwards: which numbers each seller took, which came back sold, who has paid, and whose name is on the stub that gets drawn. This guide keeps all of that in one Google Sheet, with formulas that count each seller’s sales and money and catch duplicate numbers, and uses a free Apps Script to print numbered tickets with matching stubs, one PDF per seller’s book.

Before you start: many states, provinces and cities regulate raffles (who may run one, prizes, what the ticket must say, reporting). Check the rules where you are first; this guide covers the spreadsheet and printing only. If you sell numbered gift vouchers rather than raffle chances, see the gift certificates guide, and for event check-in, the sign-in sheet guide.

Step 1: a Tickets tab with one row per ticket number

Name a tab Tickets and type these headers in row 1: No., Seller, Buyer, Phone or email, Paid, Status, Check. In A2 type =SEQUENCE(20) (use your real total, such as =SEQUENCE(300)). SEQUENCE returns 1, 2, 3 and so on down the column. Then copy the numbers and use Edit › Paste special › Values only on top of them: typed numbers stay on their row when you sort or add a buyer, while a formula’s output does not move with the data you type next to it.

ColHeaderWhat goes in it
ANo.The ticket number, a plain whole number. The leading zeros (0007) are added only when printing.
BSellerA formula, below: the seller whose book contains this number
C, DBuyer, Phone or emailTyped from the stub when the seller hands it back
EPaidA checkbox (Insert › Checkbox, see Google’s checkboxes page)
F, GStatus, CheckFormulas, below

Seller (B2, filled down) looks for the book whose First no. and Last no. contain this number. FILTER keeps the matching seller rows and INDEX takes the first one; IFERROR leaves the cell empty when no book contains the number:

=IF(A2="", "", IFERROR(INDEX(FILTER(Sellers!$A$2:$A, Sellers!$B$2:$B<=A2, Sellers!$C$2:$C>=A2), 1), ""))

Status (F2) is Not issued, With seller, Sold, or Sold, not paid:

=IF(A2="", "", IF(C2="", IF(B2="", "Not issued", "With seller"), IF(E2=TRUE, "Sold", "Sold, not paid")))

Check (G2) is empty when the row is fine. COUNTIF catches a number that is on two rows (usually a pasted or retyped block); it also flags a ticket marked paid with no buyer, and a sold ticket whose number is in nobody’s book:

=IF(A2="", "", IF(COUNTIF($A$2:$A, A2)>1, "Duplicate number", IF(AND(E2=TRUE, C2=""), "Paid, no buyer name", IF(AND(C2<>"", B2=""), "Not in any book", ""))))
A
No.
B
Seller
C
Buyer
D
Phone or email
E
Paid
F
Status
G
Check
1Maria LopezAna Ruizana@example.comTRUESold
2Maria LopezAna Ruizana@example.comTRUESold
3Maria LopezBen Cole555-0101FALSESold, not paid
4Maria LopezFALSEWith seller
5Maria LopezFALSEWith seller
6Dev PatelChris Lamchris@example.comTRUESold
7Dev PatelDana Wu555-0102TRUESoldDuplicate number
8Dev PatelTRUEWith sellerPaid, no buyer name
9Dev PatelEli Fordeli@example.comTRUESold
10Dev PatelFALSEWith seller
11Grace KimFay Moss555-0103TRUESold
12Grace KimGus Halegus@example.comFALSESold, not paid
13Grace KimFALSEWith seller
14Grace KimFALSEWith seller
15Grace KimFALSEWith seller
16Tom BakerHal Ito555-0104TRUESold
17Tom BakerFALSEWith seller
18Tom BakerFALSEWith seller
19Ivy Shawivy@example.comFALSESold, not paidNot in any book
20FALSENot issued
7Dev PatelJo Parkjo@example.comTRUESoldDuplicate number

Example data: the event, people, emails and 555-01xx phone numbers are made up. Paid shows the checkbox’s value.

Three rows need attention. Ticket 7 is on two rows, Dana Wu’s and Jo Park’s, so both say Duplicate number: find the real stub and fix the other row. Ticket 8 is ticked as paid but has no buyer, so the money came in without a name. Ticket 19 was sold but sits in nobody’s book, so no seller is accountable for it.

Step 2: a Sellers tab with one row per ticket book

Make a tab named Sellers. Type each seller’s name and the first and last number of their book in A to C; D to H are formulas, and I and J (Tickets PDF, Made at) are left empty for the script. Put these in D2 to H2 and fill them down:

=IF(A2="", "", C2-B2+1)
=IF(A2="", "", COUNTIFS(Tickets!$B$2:$B, A2, Tickets!$C$2:$C, "<>"))
=IF(A2="", "", COUNTIFS(Tickets!$B$2:$B, A2, Tickets!$E$2:$E, TRUE))
=IF(A2="", "", COUNTIFS(Tickets!$B$2:$B, A2, Tickets!$C$2:$C, "<>", Tickets!$E$2:$E, FALSE)*Summary!$B$1)
=IF(A2="", "", IF(OR(B2="", C2="", C2<B2), "Check the numbers", IF(COUNTIFS($B$2:$B, "<="&C2, $C$2:$C, ">="&B2)>1, "Overlaps another book", "")))

COUNTIFS with "<>" counts rows where Buyer is not empty. To collect multiplies the seller’s sold-but-unpaid tickets by the price in Summary!B1 (Step 3). The last formula is the overlap check: another book overlaps this one when it starts at or before this book’s last number and ends at or after its first number, and since every book overlaps itself, more than 1 means a clash.

A
Seller
B
First no.
C
Last no.
D
Tickets
E
Sold
F
Paid
G
To collect
H
Check
Maria Lopez155325
Dev Patel6105450
Grace Kim11155215Overlaps another book
Tom Baker14185110Overlaps another book

Grace Kim’s book runs to 15 but Tom Baker’s starts at 14, so tickets 14 and 15 are in both books and both rows are flagged. The Seller formula on the Tickets tab gives each shared number to the first matching row (Grace), and the script refuses to print either book until the ranges are fixed. Dev Patel’s Sold shows 4 for 3 sold numbers, because of the duplicate 7. The sellers owe $10 between them, while the Summary below says $15: the other $5 is ticket 19, which isn’t in anyone’s book.

Step 3: a Summary tab

A tab named Summary with labels in column A, the ticket price typed in B1, and these formulas in B2 to B7. COUNTA counts the named buyers, and COUNTIF with "?*" counts Check cells that contain at least one character, so the empty strings the formula returns are not counted.

RowABB holds
1Price per ticket5typed
2Ticket rows21=COUNT(Tickets!A2:A)
3Sold (buyer named)11=COUNTA(Tickets!C2:C)
4Paid9=COUNTIF(Tickets!E2:E, TRUE)
5Money in45=B4*B1
6Still to collect15=COUNTIFS(Tickets!C2:C, "<>", Tickets!E2:E, FALSE)*B1
7Rows to fix4=COUNTIF(Tickets!G2:G, "?*")

Then add three Format › Conditional formatting rules with Custom formula is: on the Tickets tab (range A2:G) =$G2<>"" in orange and =$F2="Sold, not paid" in amber, and on the Sellers tab (range A2:J) =$H2<>"" in red.

Step 4: print the tickets with stubs

Google Sheets can print a range, but it has no ticket layout or mail merge of its own. The script below builds a Google Doc for each seller’s book, with each ticket as a two-cell table: the stub on the left and the ticket on the right, both showing the same number. It then saves the Doc as a PDF in your Drive folder and writes the link back to the seller’s row.

Open Extensions › Apps Script, paste the script, set FOLDER_ID (the last part of the Drive folder’s URL), EVENT, DRAW_LINE and PRICE, and save. Then:

  1. Reload the spreadsheet. A Raffle menu appears (it is created by the script’s onOpen, as described in Google’s custom menus page).
  2. Choose Raffle › Make ticket PDFs for all books and approve the permissions. PREVIEW is true, so it makes one PDF named PREVIEW and writes nothing to the sheet.
  3. Print one page of the preview at 100% scale (not “fit to page”) and check the size and the cut lines. When it looks right, set PREVIEW = false, save, and run it again.
/**
 * Raffle tickets from Google Sheets: one printable PDF per seller's ticket book, each ticket with a matching stub.
 *
 * Tab "Sellers" (row 1 = headers, extra columns are fine), one row per ticket book:
 *   Seller | First no. | Last no. | ... | Tickets PDF | Made at
 * Tab "Tickets": one row per ticket number (column "No."), used to check that every printed number is tracked.
 *
 * Each run makes a fresh PDF for every book (or only the seller rows you have selected) in your Drive
 * folder and writes its link and the time back to the seller row. Run it with PREVIEW = true first:
 * it makes 1 PDF named "PREVIEW" and writes nothing to the sheet.
 */
const FOLDER_ID        = 'PASTE_OUTPUT_FOLDER_ID';
const EVENT            = 'Spring Fundraiser Raffle';
const DRAW_LINE        = 'Drawing: May 15, 2027, 7 PM, Riverside Community Hall';
const PRICE            = '$5';
const NUMBER_PREFIX    = 'No. ';
const DIGITS           = 4;       // 7 prints as 0007
const TICKETS_PER_PAGE = 5;
const TICKET_HEIGHT    = 110;     // points; 72 points = 1 inch
const STUB_WIDTH       = 170;     // points
const PREVIEW          = true;    // set to false for the real run
const KEEP_DOCS        = false;   // true keeps the Google Doc next to each PDF
const MAX_PER_RUN      = 20;      // books per run
const MAX_BOOK_SIZE    = 500;     // tickets per book

function onOpen() {
  SpreadsheetApp.getUi().createMenu('Raffle')
    .addItem('Make ticket PDFs for all books', 'makeAllBooks')
    .addItem('Make ticket PDFs for selected seller rows', 'makeSelectedBooks')
    .addToUi();
}

function makeAllBooks(now) {
  return makeBooks_(null, now);
}

function makeSelectedBooks(now) {
  const sh = SpreadsheetApp.getActive().getActiveSheet();
  if (sh.getName() !== 'Sellers') {
    SpreadsheetApp.getUi().alert('Select one or more rows on the Sellers tab first.');
    return null;
  }
  const range = sh.getActiveRange();
  const rows = {};
  for (let r = range.getRow(); r < range.getRow() + range.getNumRows(); r++) rows[r] = true;
  return makeBooks_(rows, now);
}

function makeBooks_(onlyRows, now) {
  now = now instanceof Date ? now : new Date();
  const lock = LockService.getDocumentLock();
  if (!lock.tryLock(30000)) return { busy: true };        // another run is busy; try again in a minute
  try {
    const started = Date.now();
    const ss = SpreadsheetApp.getActive();
    const sel = ss.getSheetByName('Sellers'), ts = ss.getSheetByName('Tickets');
    if (!sel || !ts) throw new Error('This needs a "Sellers" tab and a "Tickets" tab.');
    const sv = sel.getDataRange().getDisplayValues();
    const tv = ts.getDataRange().getDisplayValues();
    const c = columns_(sv[0], ['Seller', 'First no.', 'Last no.', 'Tickets PDF', 'Made at'], 'Sellers');
    const t = columns_(tv[0], ['No.'], 'Tickets');
    const problems = [];

    const tracked = {};
    for (let r = 1; r < tv.length; r++) {
      const n = toInt_(tv[r][t['No.']]);
      if (n !== null) tracked[n] = true;
    }
    const books = [];
    for (let r = 1; r < sv.length; r++) {
      const name = String(sv[r][c['Seller']]).trim();
      if (!name) continue;
      const first = toInt_(sv[r][c['First no.']]), last = toInt_(sv[r][c['Last no.']]);
      const where = 'Sellers row ' + (r + 1) + ' (' + name + ')';
      if (first === null || last === null || first < 1 || last < first) { problems.push(where + ': First no. and Last no. must be whole numbers, first <= last (skipped)'); continue; }
      if (last - first + 1 > MAX_BOOK_SIZE) { problems.push(where + ': more than ' + MAX_BOOK_SIZE + ' tickets in one book (skipped)'); continue; }
      books.push({ row: r + 1, name: name, first: first, last: last, where: where, bad: false });
    }
    for (let i = 0; i < books.length; i++) {
      for (let j = i + 1; j < books.length; j++) {
        const a = books[i], b = books[j];
        if (a.first <= b.last && b.first <= a.last) {               // two books share a number
          a.bad = b.bad = true;
          problems.push(a.where + ' and ' + b.where + ' overlap: ' + pad_(Math.max(a.first, b.first)) + '-' + pad_(Math.min(a.last, b.last)) + ' (both skipped)');
        }
      }
    }

    const folder = DriveApp.getFolderById(FOLDER_ID);
    let made = 0, stopped = '';
    for (const b of books) {
      if (onlyRows && !onlyRows[b.row]) continue;
      if (b.bad) continue;
      if (made >= (PREVIEW ? 1 : MAX_PER_RUN)) { stopped = 'limit'; break; }
      if (Date.now() - started > 270000) { stopped = 'time'; break; }  // stay inside the 6-minute limit
      let untracked = 0;
      for (let n = b.first; n <= b.last; n++) if (!tracked[n]) untracked++;
      if (untracked) problems.push(b.where + ': ' + untracked + ' of its numbers are not on the Tickets tab (printed anyway)');

      const name = (PREVIEW ? 'PREVIEW ' : '') + EVENT + ' tickets ' + pad_(b.first) + '-' + pad_(b.last) + ' ' + b.name;
      const doc = DocumentApp.create(name);
      const file = DriveApp.getFileById(doc.getId());
      file.moveTo(folder);
      const body = doc.getBody();
      body.setMarginTop(36).setMarginBottom(36).setMarginLeft(36).setMarginRight(36);
      body.getParagraphs()[0].setText(EVENT + ' \u00b7 ' + b.name + ' \u00b7 tickets ' + pad_(b.first) + ' to ' + pad_(b.last));
      const width = (body.getPageWidth() || 612) - 72;                // 612 pt = US Letter
      for (let n = b.first; n <= b.last; n++) {
        const stub = [NUMBER_PREFIX + pad_(n), 'Name: ______________', 'Phone or email: ______', 'Seller: ' + b.name].join('\n');
        const ticket = [EVENT, DRAW_LINE, 'Price: ' + PRICE, NUMBER_PREFIX + pad_(n)].join('\n');
        const table = body.appendTable([[stub, ticket]]);
        table.setBorderWidth(1);
        table.setColumnWidth(0, STUB_WIDTH).setColumnWidth(1, width - STUB_WIDTH);
        table.getRow(0).setMinimumHeight(TICKET_HEIGHT);
        const k = n - b.first + 1;
        if (n < b.last) {
          if (k % TICKETS_PER_PAGE === 0) body.appendPageBreak();
          else body.appendParagraph('');                             // a gap to cut along
        }
      }
      doc.saveAndClose();
      const pdf = folder.createFile(file.getAs(MimeType.PDF)).setName(name + '.pdf');
      if (!KEEP_DOCS) file.setTrashed(true);
      if (!PREVIEW) {
        sel.getRange(b.row, c['Tickets PDF'] + 1).setValue(pdf.getUrl());
        sel.getRange(b.row, c['Made at'] + 1).setValue(now);
      }
      made++;
    }
    const note = 'Made ' + made + ' ticket PDF(s)' + (PREVIEW ? ' in PREVIEW (nothing written to the sheet)' : '') + '.' +
      (problems.length ? ' ' + problems.length + ' problem(s), see the log.' : '') +
      (stopped ? ' Stopped early (' + stopped + '); run it again for the rest.' : '');
    problems.forEach((p) => console.log(p));
    ss.toast(note, 'Raffle', 10);
    return { made: made, problems: problems, stopped: stopped };
  } finally {
    lock.releaseLock();
  }
}

/** Finds each needed header (ignoring case and spaces) or stops with a clear message. */
function columns_(header, need, tab) {
  const head = header.map((h) => String(h).trim().toLowerCase());
  const missing = need.filter((n) => head.indexOf(n.toLowerCase()) < 0);
  if (missing.length) throw new Error('Missing column(s) on ' + tab + ': ' + missing.join(', '));
  const c = {};
  need.forEach((n) => { c[n] = head.indexOf(n.toLowerCase()); });
  return c;
}

/** "12", "0012" or "12.0" -> 12; anything else -> null. */
function toInt_(v) {
  const s = String(v).trim().replace(/,/g, '');
  if (!/^\d+(\.0+)?$/.test(s)) return null;
  return parseInt(s, 10);
}

function pad_(n) {
  return String(n).padStart(DIGITS, '0');
}

For the example, the first ticket in Maria Lopez’s book comes out like this (the dashed line is where you cut; the real PDF draws a solid border around both halves):

Spring Fundraiser Raffle · Maria Lopez · tickets 0001 to 0005

No. 0001
Name: ______________
Phone or email: ______
Seller: Maria Lopez
Spring Fundraiser Raffle
Drawing: May 15, 2027, 7 PM, Riverside Community Hall
Price: $5
No. 0001

… and four more tickets (0002 to 0005) on the same page.

What the script does

Step 5: the draw

Draw a stub from the drum, not from the spreadsheet: RANDBETWEEN would pick a new number every time the sheet recalculates, so the result changes as soon as anyone edits a cell. Then make a tab named Draw, type the drawn number in B1, and let XLOOKUP find it:

RowABB holds
1Ticket drawn7typed
2StatusSold=IF(B1="", "", XLOOKUP(B1, Tickets!$A$2:$A, Tickets!$F$2:$F, "No such ticket"))
3BuyerDana Wu=IF(B1="", "", XLOOKUP(B1, Tickets!$A$2:$A, Tickets!$C$2:$C, ""))
4Phone or email555-0102=IF(B1="", "", XLOOKUP(B1, Tickets!$A$2:$A, Tickets!$D$2:$D, ""))
5SellerDev Patel=IF(B1="", "", XLOOKUP(B1, Tickets!$A$2:$A, Tickets!$B$2:$B, ""))
6Rows with this number2=IF(B1="", "", COUNTIF(Tickets!$A$2:$A, B1))

Drawing 7 shows why the last row is there: XLOOKUP returns the first match (Dana Wu), but Rows with this number is 2, because Jo Park’s row also says 7. Sort that out with the stubs before announcing a winner. A number that isn’t on the Tickets tab shows No such ticket.

Pitfalls

FAQ

How do I make numbered raffle tickets in Google Sheets?

Put the ticket numbers in a column (=SEQUENCE(200) makes 1 to 200; paste them back as values so they stay put), then print them onto a ticket layout. Google Sheets has no ticket or mail-merge layout of its own, so the free Apps Script on this page builds a Google Doc with five tickets per page, each with a matching stub, and saves it as a PDF for each seller’s book of numbers.

How do I put the same number on the ticket and the stub?

Print both halves from the same row. The script on this page makes each ticket a two-cell table: the stub on the left (number, a line for the buyer’s name and phone or email, and the seller) and the ticket on the right (event, drawing details, price and the same number). Cut along the line between them; the buyer keeps the ticket and the stub goes in the drum.

How do I track who sold which raffle tickets?

Give each seller a book: a range of numbers on a Sellers tab (Maria Lopez gets 1 to 5). On the Tickets tab, =IF(A2="", "", IFERROR(INDEX(FILTER(Sellers!$A$2:$A, Sellers!$B$2:$B<=A2, Sellers!$C$2:$C>=A2), 1), "")) finds the book each number falls in, and COUNTIFS on the Sellers tab counts each seller’s sold and paid tickets and the money still to collect.

How do I find duplicate raffle ticket numbers?

=IF(A2="", "", IF(COUNTIF($A$2:$A, A2)>1, "Duplicate number", …)) flags every row whose number appears more than once, which usually comes from a pasted or retyped block. A second check on the Sellers tab flags books whose number ranges overlap, so the same number is never printed in two books.

Can Google Sheets pick a raffle winner?

RANDBETWEEN can return a random number, but it picks a new one every time the sheet recalculates, so the “winner” changes as soon as anyone edits anything. Most raffles draw a physical stub from a drum. The Draw tab on this page then looks up the drawn number and shows the buyer, their phone or email, the seller and the ticket’s status, and warns if the number is on more than one row.

Do I need a license or permit to run a raffle?

It depends on where you are: many places regulate raffles, including who may run them, prizes, ticket wording and reporting. Check with your state, provincial or local authority before you print or sell tickets. This guide covers the spreadsheet and printing only.

Need a document for each ticket buyer or each seller? SheetWeave (disclosure: we make it) is a Google Sheets add-on that fills a Google Docs template with each row's column values and saves a Doc, a PDF, or both in a Drive folder you choose, writing the links back to the row. From the Tickets tab that can be a confirmation or receipt per sold ticket, with {{Buyer}} and {{No.}} in the template; from the Sellers tab, a cover sheet per seller with their numbers, Sold and To collect. It runs on selected rows, all rows, or only new ones. For several tickets with stubs on one page, use the script above. Sheet data stays inside your Google account. 14-day free trial, no credit card required. SheetWeave is on the Google Workspace Marketplace.
See SheetWeave

Related Google Sheets guides

Instructions refer to Google Sheets and Apps Script as they worked on November 24, 2026. Not legal or tax advice, and not affiliated with Google. Google Sheets and Google Docs are trademarks of Google LLC. Raffle rules vary by place; check with your local authority. Questions or corrections: hello@loomwise.app.