Try the example, then check the result.
Download the fictional material and follow the steps below. The video uses English illustrative diagrams; it does not present a live app recording. Product controls may vary by version.
Check the answer before applying the method to your own data. How we review guides ↗
Watch the complete lesson.
The video uses English illustrative diagrams; it does not present a live app recording. English captions. Product menus may differ in your account.
This tutorial uses a fictional eight-row order export. Three IDs appear twice because a later update changed the row. The expected output is five unique IDs totaling $560, with the latest dated row for each ID. Work in a disposable spreadsheet and preserve the Raw tab. Download the practice CSV, expected output CSV, and answer check.
Before you begin
- Use Google Sheets in a desktop browser with an English interface if you are comparing menu names.
- In the disposable Sheet, choose File → Settings → Locale → United States, then save and reload. The comma-separated formulas below were verified with this spreadsheet locale. It changes this Sheet's formatting and formula separators, not your Google Account's interface language. If you keep another locale, adapt the separators and recheck the imported dates before using the formulas.
- The CSV headers are Order ID, Updated, Customer, and Amount USD. The eight Updated values use YYYY-MM-DD, all are unique, and the current exercise has no blank IDs.
- Create a new spreadsheet and import the practice CSV. Rename the imported sheet Raw. Confirm eight data rows in A2:D9 and the raw amount total of $980 before proceeding.
- If Sheets interprets the date column differently in your locale, confirm the displayed date for each row. The logic assumes chronological sorting, not an arbitrary text order.
| ID | Older amount | Latest amount | Latest date |
|---|---|---|---|
| O-501 | $120 | $125 | 2026-10-06 |
| O-503 | $90 | $95 | 2026-10-07 |
| O-504 | $210 | $205 | 2026-10-08 |
Swipe or scroll sideways to see every table column →
Keep the latest row without deleting the source
- Add a tab named Sorted. Copy the four headers from Raw!A1:D1 into Sorted!A1:D1.
- In Sorted!A2, enter =SORT(Raw!A2:D9,2,FALSE). This sorts the whole row range by its second column, Updated, descending. The first data row should be O-504 dated 2026-10-08. If it is not, inspect how the dates were imported before continuing.
- Type Decision in Sorted!E1. In Sorted!E2, enter =IF(COUNTIF($A$2:A2,A2)=1,"KEEP","OLDER COPY"); fill down through E9. The anchored start of the COUNTIF range stays at row 2 while the end advances with each row.
- Expect five KEEP and three OLDER COPY results. If the count differs, confirm that all eight sorted rows and the full formula range are present. Do not run a destructive duplicate removal yet.
- Add a tab named Latest and copy the four headers into row 1. In Latest!A2, enter =FILTER(Sorted!A2:D9,Sorted!E2:E9="KEEP"). The matching five rows should spill into A2:D6.
| Expected order | Order ID | Updated | Amount USD |
|---|---|---|---|
| 1 | O-504 | 2026-10-08 | $205 |
| 2 | O-503 | 2026-10-07 | $95 |
| 3 | O-501 | 2026-10-06 | $125 |
| 4 | O-505 | 2026-10-04 | $60 |
| 5 | O-502 | 2026-10-03 | $75 |
Swipe or scroll sideways to see every table column →
Pass check: five distinct IDs, these exact five dates and amounts, and a sum of $560. The expected CSV is an independent row-by-row answer, not a live Sheets capture.
Why the shortcut can be wrong
Google's Data → Data cleanup → Remove duplicates tool compares the columns you select. In this practice, a repeated ID has different dates or amounts, so comparing all four columns does not collapse that pair. Selecting only the ID before deliberately choosing the newest row may keep the wrong update. The Sorted/Decision/Latest approach leaves the original untouched and exposes which row won.
This method assumes one clearly newest row per ID. If dates tie, define another tie breaker such as a trusted update timestamp before selecting a winner. For real data, also resolve blank IDs, inconsistent date formats, and currency differences before following the example.
Troubleshooting
- The SORT result starts with O-501 or a date looks wrong: Inspect the imported date type and the exact Raw!A2:D9 range. This example depends on correct chronological ordering.
- COUNTIF labels all rows KEEP: Check the absolute start $A$2 and the advancing end A2; fill the formula from E2 to E9.
- FILTER returns #N/A: Confirm there are exact KEEP values in Sorted!E2:E9 and that the range heights match.
- Five IDs but total is not $560: Compare the five amounts and dates with the table and answer CSV. A row count alone is insufficient.
Sources and evidence
Reviewed 9 October 2026: Google's help for spreadsheet locale, SORT, COUNTIF, IF, FILTER, and Remove duplicates. The fixture arithmetic was checked independently. The exact comma formulas were also run in a private fictional Google Sheet set to United States locale: SORT placed O-504 first, the Decision column returned five KEEP and three OLDER COPY rows, FILTER returned the expected five records, and their amount sum was $560. Spreadsheet locales that expect another argument separator can reject the comma formulas; adapt the separators and recheck the imported dates. The companion video uses labeled English illustrative diagrams, not app screen recordings.
Practice downloads.
The exercise files contain invented information. Save a local copy before editing.