Skip to content
All tutorials

Find repeated campaign IDs before merging report exports

FormulaCraft · Reviewed 2026-09-16

Use COUNTIF to count how many times a campaign ID appears in the export. In this sample, cmp-101 appears twice, so the result is 2. A repeated ID is a review flag, not proof that a row should be deleted: the same campaign can legitimately appear on several dates, devices or placement rows.

Count occurrences of the first campaign ID

Campaign IDDateSpend
cmp-1012026-08-01100
cmp-1022026-08-01200
cmp-1012026-08-01100
cmp-1032026-08-0150
Download sample data (CSV)

Excel

=COUNTIF(A2:A5,A2)

Google Sheets

=COUNTIF(A2:A5,A2)

Expected result: 2

The value in A2 is cmp-101. It occurs in A2 and A4, and nowhere else in A2:A5, so the independent count is 2.

Both expressions are checked against the expected result in HyperFormula. This is an engine check, not a native Excel or Google Sheets certification. The CSV contains sample data; paste the formula into an empty cell.

Understand what one row represents

Before looking for duplicates, decide whether a row represents a campaign, a campaign-day or a campaign-placement-day. Export settings determine the detail of the table.

In the fictional sample, the two cmp-101 rows have the same date and spend. They deserve investigation, but identical values alone do not prove an accidental duplication in every reporting system.

Count the selected campaign ID

Paste the example into an empty cell outside A1:C5. It counts occurrences of the value in A2 across the four campaign-ID cells. The result should be 2.

The first and third data rows match cmp-101. The other two campaign IDs do not match. This small check is easy to reconcile visually before adapting the formula to a larger export.

Adapt the check without deleting valid rows

Extend the inspected range when your table grows. If you copy the formula down, keep the full search range fixed with absolute references and let the criterion cell follow the row.

When one campaign appears on multiple dates, ID-only matching is too broad. Compare all fields that define a unique row, such as account, campaign ID, date, placement and attribution setting. Preserve the original export before removing anything.

Resolve identifiers and export overlap

Use campaign IDs rather than names where possible because names can change or be reused. Store long identifiers as text so a spreadsheet does not round their digits.

COUNTIF is not case-sensitive. If case distinguishes your identifiers, use a method that preserves that distinction. Check labels for spaces and special wildcard characters before relying on a count as an exact identity comparison.

Common questions

Does a result of 2 mean I should delete one row?

No. Review the date and other breakdown dimensions first. The rows may represent separate valid observations.

Can I use campaign names instead of IDs?

You can count names, but repeated or renamed campaigns can make that check ambiguous. Stable identifiers are usually better for export reconciliation.

Will this repair an already inflated spend total?

No. It flags repetition in the input. Investigate the source rows, correct confirmed duplicate exports, then recalculate the report.

Sources

Continue working