Organize information

Normalize text formatting in Excel

Standardize presentation differences without changing identifiers or meaningful text

6 min setupTested with:ChatGPTReviewed: 2026-08-28
1

Add your context

Your text stays in this browser. AILesson Prompts does not send it to a model or server.

2

Your prompt

Unfilled fields remain visible as placeholders, so you can still copy and edit the prompt

Design field-specific Excel rules to normalize text formatting.

Fields and meanings:
[fields]

Representative values:
[samples]

Approved display standard:
[standard]

Separate harmless presentation cleanup from transformations that could change identity or meaning. Do not apply PROPER, remove punctuation, or convert text to numbers across every field. Preserve raw values and return one rule or formula per field, an exception condition, and before/after examples. Test nonbreaking spaces, repeated internal spaces, apostrophes, hyphens, acronyms, multilingual text, blanks, and identifiers with leading zeros.
Private by defaultPrompt assembly happens locally in your browser. Avoid placing confidential information into any AI service unless your organization allows it.

From input to outcome

A worked example

See how concrete context turns this recipe into a usable result

Actual input

Fields and meanings
A CustomerCode is a text identifier where leading zeros matter; B Email is case-insensitive for our matching; C ContactName is human-entered multilingual text; D Status is a controlled label.
Representative values
A: 001-AB, ' 001-AB '; B: ANA@EXAMPLE.COM, ana@example.com plus nonbreaking spaces; C: o'connor, ANA PÉREZ, 王 小明; D: in progress, In Progress, IN-PROGRESS.
Approved display standard
CustomerCode: trim outer whitespace only. Email: trim and lowercase. ContactName: remove outer and repeated spaces but do not force case. Status: canonical value 'In progress' after an approved mapping.

Example output

Keep the four raw columns and create clean companions. Replace nonbreaking spaces with ordinary spaces before trimming.

  • CustomerCode: =TRIM(SUBSTITUTE(A2,CHAR(160)," ")). Do not VALUE-convert or remove the hyphen; 001-AB must remain text. Flag any internal spaces.
  • Email: =LOWER(TRIM(SUBSTITUTE(B2,CHAR(160)," "))). Flag values that contain internal spaces or lack a usable @ structure; do not invent a corrected address.
  • ContactName: Microsoft 365: =TEXTJOIN(" ",TRUE,TEXTSPLIT(TRIM(SUBSTITUTE(C2,CHAR(160)," "))," ",,TRUE)). This collapses repeated spaces but deliberately preserves o'connor, ANA PÉREZ, and Chinese characters as entered. Do not use PROPER without human approval.
  • Status: normalize a comparison key with lowercase, trimmed spaces, and an approved hyphen-to-space rule, then XLOOKUP that key in a two-column mapping table. Unmapped values return Review.

Tests confirm that the customer code keeps both zeros, the two email variants normalize equally, names retain punctuation and case, and the three approved status variants map to In progress. Store RuleApplied and ReviewReason next to every clean value.

Why this works

  1. 1

    Field-specific rules prevent a visual cleanup from corrupting IDs, acronyms, or names.

  2. 2

    Raw and clean columns reveal every transformation instead of overwriting evidence.

Check the result

  • Has each field been classified as free text, controlled label, or identifier?

  • Are leading zeros and meaningful punctuation preserved?

  • Can changed values be compared directly with their raw source?

More ways to explore

Where this recipe fits

Keep the work moving