How to Merge Duplicate Rows in Google Sheets: Sum the Numbers, Join the Notes and Fill the Blanks (2026)

An order export with the same customer on five rows, a sign-up sheet where people registered twice, a contact list built from three sources: deleting the extra rows is easy, but it throws information away. The second row has the phone number the first one lacks, the third has another order amount, the fourth a note you need. What you usually want is to merge the duplicates: one row per customer, with the amounts added up, the notes joined and the blanks filled in. This guide shows three ways to do that in Google Sheets without touching the original rows, and how to swap the merged rows in afterwards.

The example

A tab called Orders with a header row: Email in A, Name in B, Phone in C, Amount in D and Notes in E.

RowA: EmailB: NameC: PhoneD: AmountE: Notes
2ana@x.comAna40Gift wrap
3bo@x.comBo304-555-010225
4Ana@x.comAna Ruiz304-555-010115Rush
5cy@x.comCy30
6ana@x.com␣10Gift wrap
7bo@x.comBo20Invoice sent

Row 6 has a trailing space after the email (shown as ␣), the kind that comes in from exports and copy-paste. Six rows, three customers, 140 in total. The goal:

EmailNamePhoneOrdersTotalNotes
ana@x.comAna304-555-0101365Gift wrap, Rush
bo@x.comBo304-555-0102245Invoice sent
cy@x.comCy130

Why not just use Remove duplicates?

Data › Data cleanup › Remove duplicates deletes rows. Ticking only the Email column, it keeps the first row for each email and removes the rest; Google’s help notes that values that differ only in letter case count as duplicates. After trimming spaces, that leaves three rows here, but the total drops from 140 to 95, Ana’s phone number disappears with row 4, and the notes “Rush” and “Invoice sent” are gone. That is fine when the extra rows are true copies. When they carry different information, merge first.

Step 0: decide what each column should become

Clean the key first: select column A and choose Data › Data cleanup › Trim whitespace. It removes leading, trailing and repeated spaces, but not non-breaking spaces.

Method 1: a pivot table (no formulas)

  1. Select the data including the header row (every column needs a header), then choose Insert › Pivot table and create it on a new sheet.
  2. In the side panel, next to Rows, click Add and choose Email.
  3. Next to Values, click Add and choose Amount; set Summarize by to SUM if it shows something else. Add Email under Values as well, summarized by COUNTA, for the number of rows per customer.

The pivot table refreshes when the source data changes. It is the quickest way to get totals per key, but it cannot join notes or pick a phone number. If your emails vary in capitalization, add a key column to the Orders tab (header Key in F1, then this in F2) and put Key under Rows instead of Email:

=ARRAYFORMULA(IF(A2:A="", "", LOWER(TRIM(A2:A))))

Method 2: QUERY with group by

One formula on a new tab, with empty cells below and to the right for the result to spill into:

=QUERY(Orders!A1:E, "select lower(A), count(A), sum(D) where A <> '' group by lower(A) label lower(A) 'Email', count(A) 'Orders', sum(D) 'Total'", 1)
EmailOrdersTotal
ana@x.com365
bo@x.com245
cy@x.com130

group by makes one row for each distinct value and sorts the result by it. lower(A) folds the letter case, which matters because string comparisons in the query language are case-sensitive: the simpler =QUERY(Orders!A1:E, "select A, sum(D) where A <> '' group by A", 1) would give Ana@x.com a row of its own with 15. QUERY does not trim, so run Trim whitespace first; before trimming, the email with the trailing space forms a fourth group. where A <> '' skips the empty rows at the bottom, and the final 1 says the range has one header row. Like the pivot table, QUERY can add up, count, average or take the max or min of a column, but it cannot join text.

Method 3: one formula that merges whole rows

This returns the full merged table from the goal above: the key, the first non-blank name and phone, the number of rows, the total and the distinct notes. Paste it into A2 of a new tab; the line breaks are fine to keep.

=ARRAYFORMULA(LET(k, LOWER(TRIM(Orders!A2:A)), u, UNIQUE(FILTER(k, k<>"")),
  HSTACK(u,
    MAP(u, LAMBDA(x, IFERROR(INDEX(FILTER(Orders!B2:B, k=x, Orders!B2:B<>""), 1)))),
    MAP(u, LAMBDA(x, IFERROR(INDEX(FILTER(Orders!C2:C, k=x, Orders!C2:C<>""), 1)))),
    MAP(u, LAMBDA(x, ROWS(FILTER(k, k=x)))),
    MAP(u, LAMBDA(x, SUM(FILTER(Orders!D2:D, k=x)))),
    MAP(u, LAMBDA(x, IFERROR(TEXTJOIN(", ", TRUE, UNIQUE(FILTER(Orders!E2:E, k=x, Orders!E2:E<>""))))))
  )))

How it works:

Add a header row by wrapping the whole thing in VSTACK with the labels first:

=VSTACK({"Email", "Name", "Phone", "Orders", "Total", "Notes"}, ARRAYFORMULA(LET(k, …)))

Replace the … with the rest of the formula above. Every MAP filters the whole tab once per key, which is fine for a few thousand rows; on bigger tabs use fixed ranges such as Orders!A2:A5000 to keep it fast.

Variations

Replace the original rows with the merged ones

  1. Right-click the Orders tab and choose Duplicate, so you keep an untouched copy.
  2. Select the merged result, copy it, go to a new tab and use Edit › Paste special › Values only (Ctrl+Shift+V, ⌘+Shift+V on a Mac). The pasted cells are plain values and no longer change.
  3. Check the totals: =SUM(Orders!D2:D) and the sum of the merged Total column must be equal (140 here). Also compare the row count with the number of distinct keys.
  4. Work from the new tab. Delete the backup only once you are sure nothing is missing.

Pitfalls

To see how many rows each key has before you merge, see how to count duplicates. To merge lists that live on several tabs, stack them first as in combine lists without duplicates and use the stacked range as the source.

FAQ

How do I combine duplicate rows and add up their values in Google Sheets?

Use QUERY with group by, for example =QUERY(Orders!A1:E, "select lower(A), sum(D) where A <> '' group by lower(A)", 1), or a pivot table with the key column under Rows and the amount column under Values summarized by SUM. Both leave the original rows untouched and return one row per key.

Why doesn’t Data › Data cleanup › Remove duplicates merge the rows?

It deletes rows: it keeps the first row of each group and removes the others, so the amounts and notes on the removed rows are gone. Build the merged rows with a formula first, then replace the original if you need to.

How do I join the text from duplicate rows into one cell?

Use TEXTJOIN over a FILTER of the rows with the same key, wrapped in UNIQUE so each note appears once: =IFERROR(TEXTJOIN(", ", TRUE, UNIQUE(FILTER(Orders!E2:E, k=x, Orders!E2:E<>"")))) inside MAP, as in the full formula in this guide.

How do I fill in blanks from the other duplicate rows?

Take the first non-blank value per key: IFERROR(INDEX(FILTER(Orders!C2:C, k=x, Orders!C2:C<>""), 1)). If one row has the phone number and another doesn’t, the merged row gets the number.

Why does my merged list still show the same email twice?

The two values differ in letter case or a stray space. UNIQUE and QUERY group by compare text exactly. Lowercase and trim the key first, with LOWER(TRIM()) in a formula or lower() in QUERY plus Data › Data cleanup › Trim whitespace on the column.

How do I turn the merged rows into normal values?

Copy the result and use Edit › Paste special › Values only on a new tab. Keep a copy of the original tab until you have checked that the totals match.

Rather merge duplicates from a sidebar? SheetDupes (disclosure: we make it) is a Google Sheets add-on that finds, highlights and removes duplicates. Pick the columns that define a duplicate, preview the matching groups, highlight the extra rows without changing any values, and then remove them or merge each group into one row: it starts from the first or last row of the group, fills its blank cells from the other rows and joins the distinct values of the columns you choose, such as notes. It copies a backup tab before it removes or merges anything, ignores extra spaces and, optionally, letter case and punctuation. It doesn’t add up amounts, so use the QUERY or pivot table method above for totals. Preview and Highlight are free on any size sheet; there is a 14-day free trial with no credit card, and writes remain free after the trial on sheets with up to 2,000 data rows during launch (through Jan 31, 2027; 500 after that). It only reads and writes the spreadsheet you have open, and your data is not sent to Loomwise. It is live on the Google Workspace Marketplace.
Install free from Google Workspace MarketplaceSee SheetDupes
Want to test it first? Try it on sample data (makes a copy of a 12-row example sheet in your Drive).

Related guides

Menu steps follow Google’s Docs Editors Help pages on removing duplicates and trimming whitespace, pivot tables and paste special; query syntax follows the QUERY help page and Google’s Query Language reference (group by, lower(), case sensitivity); function behavior is from the help pages for UNIQUE, FILTER, LET, MAP, LAMBDA, HSTACK, INDEX, IFERROR, TEXTJOIN, SUM and TRIM. Instructions refer to Google Sheets as it worked on November 19, 2026; menu names can change. Google Sheets is a trademark of Google LLC and this site is not affiliated with Google. Questions or corrections: hello@loomwise.app.