Don't count the same order twice in Excel

MuraByte | Practical Excel

An export can show the same paid order twice. If you sum the Amount column, a duplicate, an unpaid order and a refund can all creep into your sales figure. In this example the raw total is 1,165 EGP, but the total for unique orders marked Paid is 515 EGP.

Excel walkthrough

Copy the practice table into A1 in a blank Excel sheet. Amounts are in EGP. Each order is meant to appear once; 1002 is an exact repeat for practice.

Practice data
Order ID Status Amount (EGP)
1001 Paid 240
1002 Paid 180
1002 Paid 180
1003 Pending 320
1004 Refunded 150
1005 Paid 95
  1. Flag repeats. Label D1 Order check. In D2, enter =IF(COUNTIF($A$2:A2,A2)>1,"Repeat","First") and fill through D7. The start of the range stays fixed while the end moves down, so the second 1002 reads Repeat.
  2. Review before totaling. Keep the export unchanged. Check that the two 1002 rows agree on status and amount. If an order repeats with a different status or amount, check the source and resolve it before using this formula for reporting. If the export has multiple line items per order, don't deduplicate by order ID alone.
  3. Count paid orders only. Label E1 Counted (EGP). In E2, enter =IF(AND(B2="Paid",D2="First"),C2,0) and fill through E7. Enter =SUM(E2:E7) in E9. It should return 515 (240 + 180 + 95). The second 1002, the pending order and the refunded order each contribute zero.

Try it: Change order 1003 from Pending to Paid. The total should rise to 835 EGP. If your Excel uses semicolons between arguments, replace the commas in the formulas with semicolons. If your export has blank order IDs, resolve those before running this check.

This is a paid-orders check for the example, not a profit, tax or bank-deposit report. Original example prepared with AI assistance and checked on synthetic data. No affiliate links in this tutorial.