Prepyr

How to fix mixed date formats in Excel or CSV safely

Standardize mixed dates by identifying each syntax family, using unambiguous values to infer that family’s date order, preserving date-time and timezone information, and refusing to guess values such as 03/04/2026 when both interpretations remain possible. Convert into a candidate column first and accept it only when every nonblank input is accounted for.

Where the difficulty begins

A date column may combine ISO dates, US slash dates, day-first dates, month names, Excel serial numbers, timestamps, and blanks. A permissive parser can swap month and day or coerce valid values to null while claiming success.

From the field · School attendance administrator

Fix mixed student attendance dates without assigning a child to the wrong day

Attendance records arrive from two systems: one exports DD/MM/YYYY, another MM/DD/YYYY, and an older workbook contains Excel serial dates. Values such as 13/04/2026 reveal the family, but 03/04/2026 remains ambiguous unless the source and locale are retained.

Columns used in the example

student_id · attendance_date_raw · source_system · school_locale · attendance_status

Follow it with your own file

  1. Group values by source system and syntax before parsing them.
  2. Use impossible month values and documented source locale to establish a rule for each group.
  3. Convert into attendance_date_candidate while preserving attendance_date_raw.
  4. Place unresolved ambiguous values in an exception table for human confirmation.

Check: Every nonblank source date must become either one validated date or one explicit exception. Compare counts by source and school day, and confirm that conversion does not move attendance between terms or create new blanks.

Check the source before you publish

  • Source values retained
  • Syntax families counted
  • Order supported by evidence
  • Ambiguous values listed
  • Nulls and period totals reconciled

Build the result step by step

  1. Inventory date representations: Group nonblank values by syntax: ISO, slash-separated, month-name, numeric serial, timestamp, and unsupported text. Count each family and retain examples.
  2. Resolve date order using evidence: Infer day-first or month-first only from unambiguous values in the same family. Ask when a family contains only ambiguous dates.
  3. Parse into a candidate column: Retain source text, parse with explicit rules, and report every value that failed or lost precision. Do not overwrite the original yet.
  4. Validate calendar and business constraints: Check plausible ranges, min and max dates, period counts, null deltas, and known events before accepting ISO output.

What may be distorting the answer

  • Monthly totals shift after parsing.
  • Only the first formatting pattern converts.
  • Dates cluster on the first twelve days of each month.
  • Timezone offsets or time-of-day values disappear.

Why valid-looking dates fail

Most failures come from treating an entire column as one format. A parser configured for YYYY-MM-DD rejects 22-Mar-2026; a guessing parser may interpret 04/05/2026 differently across machines. Numeric values may be spreadsheet dates, IDs, or measures.

The goal is not to make every value parse at any cost. It is to preserve meaning and expose uncertainty.

Validate semantics after syntax

A syntactically valid date can still be wrong. Signup dates should not predate a launch or fall far in the future. Transactions may require timezones. Birth dates have plausible ranges. Formatting alone cannot establish business correctness.

Common strategies for mixed dates

StrategyRiskUse when
Automatic guessingMonth/day swaps and silent nullsAvoid for critical data
One explicit formatRejects other valid familiesThe source contract guarantees one format
Family-based parsingRequires reviewFiles combine exports or manual entry

The decisions that matter

  • Do not apply one format string to a column containing several syntax families.
  • Use days greater than 12 to infer order only within the same source family.
  • Keep original text beside the candidate result until validation is complete.
  • Ambiguous dates need source context or a user decision, not an AI guess.

Doing these steps in Prepyr

Prepyr accepts CSV files only. Export the worksheet or table you need as a UTF-8 CSV first; workbook formulas, formatting, macros, charts, and other sheets will not be included. Describe the result you need: Fix mixed date formats in Excel or CSV without guessing ambiguous dates. Check the columns selected, preview any proposed changes, and compare the output with the source before applying or exporting it.

Prepyr steps used here: Safe conversion · Changed Row preview · Validation contracts · Version restore

A consistently typed date column with a documented interpretation, no silent null creation, and explicit exceptions requiring human context.

Questions readers usually ask next

What format should cleaned dates use?

ISO 8601, usually YYYY-MM-DD or a timezone-aware timestamp, is a strong interchange format because it is ordered and relatively unambiguous.

Can software tell whether 03/04/2026 is March 4 or 3 April?

Not without a source convention or unambiguous neighboring evidence. Both interpretations are valid, so the safe response is to ask.

Why did valid dates become NaT?

A parser likely inferred one format or coerced errors to null. Use explicit format families and abort when new nulls appear.