How to Char Function in Excel
Learn multiple Excel methods to char function with step-by-step examples and practical applications.
How to Char Function in Excel
Why This Task Matters in Excel
Whether you prepare customer-facing reports, automate data imports, or design dashboards with dynamic symbols, at some point you will need to translate numeric character codes into visible characters. That single requirement opens the door to a surprisingly broad set of business scenarios:
- Data Cleansing and Imports
- Many legacy systems export text using ASCII or ANSI codes instead of literal characters. Translating code 10 to a line break, code 44 to a comma, or code 160 to a non-breaking space allows you to clean raw feeds before analysis.
- Visual Indicators in Dashboards
- Executives love compact visuals. By turning code 9650 into ▲ and code 9660 into ▼ you can embed trend arrows directly in cells without external images, reducing file size and increasing portability.
- Controlled Text Construction
- Mail-merge style letters, invoice generators, and automated emails often require exact control over hidden characters such as tab, carriage return, or line feed. Using character codes preserves those items even after copy-paste.
- Barcode and QR Code Preparation
- Many barcode fonts depend on feeding the correct control characters. A finance team generating EAN-128 labels might need code 232 (FNC1) inserted at specific positions.
- Specialty Compliance Reports
- Regulatory filing systems may mandate delimiter characters that are hard to type from the keyboard (for instance, character code 254 ¬ or 182 ¶). Converting numeric requirements into characters avoids typos.
Excel is perfectly suited for these problems because it combines immediate visual feedback with a rich set of text functions, can scale from quick one-off conversions to reusable templates, and integrates with Power Query, VBA, and Power BI. Ignoring the skill means manual look-ups, broken imports, and unreadable reports. Mastering the CHAR function (and its sibling UNICHAR) connects directly to other text-manipulation techniques such as SUBSTITUTE, CLEAN, TEXTJOIN, and dynamic arrays—making it a foundational skill for anyone serious about Excel-based automation.
Best Excel Approach
The primary tool for translating a number into a character in Excel is the CHAR function (for legacy 1–255 code points) or UNICHAR (for modern Unicode values 1–1,114,111). CHAR is lightning-fast, works in every supported Excel version, and returns a one-character text string. It integrates seamlessly with concatenation, TEXTJOIN, and dynamic array formulas.
Syntax:
=CHAR(number)
number– Required. An integer from 1 to 255 referencing the Windows-1252 (ANSI) code page.- Result – A single-character text value.
Why this method is usually best:
- Instant, no helper tables needed.
- Works in worksheet formulas, conditional formatting, data validation, and even charts.
- Round-trips with CODE, so you can both decode and encode safely.
- Compatible all the way back to Excel 97, ensuring that files shared across departments remain functional.
When to consider alternatives:
- You need characters outside the 1–255 range (for example, emoji). Use UNICHAR.
- You must automate inside VBA. Use
Chr()orChrW(). - You want character lookup from a table—e.g., translating a list of codes posted on the web. Then XLOOKUP over a reference table can be helpful.
Alternative formula for Unicode:
=UNICHAR(number)
Parameters and Inputs
Before you build formulas, confirm:
- Input
numbermust be numeric (integer). Non-integers are truncated—code 65.9 still becomes 65. - Valid range is 1 to 255 for CHAR; 1 to 1,114,111 for UNICHAR. Anything outside throws #VALUE!
- Data format: values stored as numbers, not text. If your imports arrive as \"065\", wrap them in
VALUE()or use--"065"to force conversion. - Control characters (codes 1–31) may return invisible results. Excel displays some as blank or as a tiny square placeholder.
- Code page reliance: CHAR follows Windows-1252 on Windows, but older Mac versions used Macintosh Roman. Modern Microsoft 365 aligns across platforms; still, test if you depend on extended characters 128–159.
- Edge cases:
- Code 10 (line feed) in text displayed within a single cell forces line breaks when Wrap Text is on.
- Code 160 (non-breaking space) can disrupt TRIM and CLEAN operations.
Prepare your source columns with clear numeric validation (Data ► Data Validation ► Whole number between 1 and 255) to prevent formula errors downstream.
Step-by-Step Examples
Example 1: Basic Scenario – Displaying Checkmarks
Imagine a quality checklist where a supervisor logs 1 for pass and 0 for fail in [B2:B10]. You want column C to show ✓ for pass and ✕ for fail.
- Enter the following formula in C2 and copy downward:
=IF(B2=1,CHAR(252),"✕")
- Apply Wingdings font to column C. In Wingdings, character code 252 corresponds to ✓.
- Result: Each pass shows a green checkmark (if you add Conditional Formatting), while fails show ✕.
Why this works: CHAR translates 252 to the underlying glyph in Wingdings. Because fonts redefine glyphs, the numeric code remains the same while the visual representation changes as you switch fonts—handy for icons without images.
Variations:
- Switch to Webdings and use code 51 for a tick symbol.
- Replace the hard-coded ✕ with
CHAR(251)in Wingdings for a consistent font approach.
Troubleshooting:
- Blank output? Verify Wrap Text—if you used code 10 by mistake, it may render invisible.
- Wrong glyph? Ensure correct font in that cell only, not the entire sheet.
Example 2: Real-World Application – Building Delimited Export Files
A logistics company exports shipment data from Excel, but the receiving customs system expects pipe-separated files with line feeds at the end of each record (code 10). They also mandate a non-breaking space (code 160) as a placeholder for optional fields.
Setup:
- Columns A:E contain Shipment ID, Country, Weight, Hazardous Flag, Notes.
- You need a single column F that concatenates those five fields, replacing blanks with a non-breaking space, and appending a line feed.
- In F2 enter:
=TEXTJOIN("|",TRUE,IF(A2:E2=""," "&CHAR(160),A2:E2)) & CHAR(10)
Explanation:
IF(A2:E2="", " "&CHAR(160), A2:E2)creates a dynamic array that substitutes a non-breaking space where the data is blank. The" "forces a visible placeholder when you open the file in Notepad.TEXTJOIN("|",TRUE, … )concatenates the five elements with pipes, ignoring additional empties after the substitution.& CHAR(10)appends a line feed so each record ends with an LF character.
- Copy down to all rows, then save the file as Unicode Text (.txt)*.
- When opened in a plain-text editor, each line appears exactly as required.
Integration with other features:
- Power Query can load the final column directly and export.
- If you later automate with VBA, the same logic applies—
Chr(160)andvbLf.
Performance note: TEXTJOIN with an array can become slow on 50,000+ rows. For heavy exports, push the logic into Power Query or a VBA macro.
Example 3: Advanced Technique – Dynamic Arrows in Conditional Formatting
Goal: Display up, down, or sideways arrows in a KPI table without helper columns. Use conditional formatting with a CHAR formula.
- Dataset:
- B2:B20 holds current month value.
- C2:C20 holds previous month value.
- Select range B2:B20.
- Home ► Conditional Formatting ► New Rule ► Use a formula.
- For Up arrow rule:
=B2>C2
- Set custom format ► Font ► Font = Wingdings 3, Color = Green.
- Type
CHAR(233)into the Type field under Number ► Custom ► General; this stores the formula result. - Repeat for Down arrow rule (
=B2<C2, red, CHAR(234)). - Repeat for Flat arrow rule (
=B2=C2, gray, CHAR(232)).
Explanation: Wingdings 3 maps 233 to ▲, 234 to ▼, and 232 to ►. Conditional formatting evaluates the formula, applies the font, and uses the Number Format to display the arrow directly in the value cell—no helper columns, fully dynamic.
Professional tips:
- Turn off Show Values so the cell only shows the icon.
- Combine with custom number formats like
"▲ "0.0%if you want both the arrow and the value.
Edge cases:
- If users copy the cell, they may paste the underlying number. Provide a Paste as Values instruction.
- Test on Mac: Wingdings 3 is present but older versions differed. Use UNICHAR with actual Unicode arrow points (9650, 9660, 9654) and a standard font like Segoe UI Symbol for cross-platform safety:
=UNICHAR(9650)
Tips and Best Practices
- Pair with CODE: Quickly verify unknown characters with
=CODE(A1)or=UNICODE(A1)to avoid guesswork. - Keep a lookup sheet: Maintain a mini-table of frequently used codes (tick, cross, arrows, NBSP) and reference them with XLOOKUP for self-documenting formulas.
- Use Unicode for universality: Modern Windows and Mac both support Segoe UI Symbol.
UNICHAR(10004)gives a green tick without special fonts. - Avoid hidden control codes: CLEAN removes codes 0–31 except 9, 10, 13. Wrap external imports in
=CLEAN(A1)to prevent downstream issues. - Conditional formatting caching: Store the desired character in a named range, e.g.,
rngUpArrow, then set the Number Format to=rngUpArrowfor easy updates. - Performance: When generating thousands of characters in arrays, spill once and reference rather than repeating CHAR. Dynamic arrays cache the result.
Common Mistakes to Avoid
- Using the wrong code page: Codes 128–159 differ between Windows and earlier Mac Excel. If your arrows turn into accented letters, you’re on the wrong font or platform. Solution: switch to UNICHAR.
- Forgetting to set the font: CHAR(252) without Wingdings renders ü. Always format the cell after inserting the formula.
- Hard-coding invisible characters: Code 160 in formulas can be hard to spot. Use
CHAR(160)so future editors understand where it came from. - Non-numeric inputs: Text \"10\" will still work due to implicit conversion, but \" 10 \" or \"ten\" triggers #VALUE!. Trim or validate inputs prior to CHAR.
- Overusing line feeds: Multiple CHAR(10) in a row can bloat cell height and printing. Use SUBSTITUTE to condense or clean before presentation.
Alternative Methods
| Method | Strengths | Weaknesses | Best for |
|---|---|---|---|
| CHAR | Native, fast, works in all Excel versions | Limited to 1-255 ANSI codes | Legacy symbols, control characters |
| UNICHAR | Full Unicode support, cross-platform | Not available before Excel 2013 | Emoji, extended arrows, math |
| VBA Chr / ChrW | Procedural, can loop over huge datasets | Requires macro-enabled files, security prompts | Automated exports, user forms |
| Lookup Table | Fully customizable, easy to document | Takes extra space, manual maintenance | Teams unfamiliar with code values |
| Power Query Add-Column | No formulas in the grid, can transform on load | Slightly slower refresh, advanced interface | ETL pipelines, recurring imports |
Comparison:
- Performance – CHAR is fastest inside the grid; VBA beats it when exporting millions of rows.
- Compatibility – CHAR plus basic fonts travels well; UNICHAR safest for modern stacks.
- Maintainability – Lookup tables and named ranges make symbolism transparent to future editors.
Migration: If you start with CHAR but later need emoji, wrap the numeric code in a helper column and swap CHAR for UNICHAR—formulas stay readable.
FAQ
When should I use this approach?
Use CHAR when you already have numeric codes 1-255 or need classic ANSI control characters, and you are distributing the file to users on varied Excel versions dating back to 2007.
Can this work across multiple sheets?
Yes. Place the formula in any sheet, and reference a code stored elsewhere [Config]!B2 as =CHAR(Config!B2) for centralized control. Spill ranges also work: =CHAR(A2:A10) produces a vertical array of symbols.
What are the limitations?
1-255 range, code-page dependency, and font substitution are the main constraints. Characters 14–31 may not render or may show placeholders. Use UNICHAR if you need a broader set.
How do I handle errors?
Wrap in IFERROR: =IFERROR(CHAR(A2),"Invalid Code"). For bulk cleansing, validate with =AND(A2=INT(A2),A2 ≥ 1,A2 ≤ 255) before calling CHAR.
Does this work in older Excel versions?
CHAR is supported back to Excel 97. UNICHAR requires Excel 2013 or later. If you share with extremely old environments, avoid UNICHAR or provide fallback glyphs.
What about performance with large datasets?
CHAR itself is lightweight. The bottleneck is often concatenation and volatile functions. Cache results in helper columns, convert to values after generation, or switch heavy exports to Power Query or VBA for better memory usage.
Conclusion
Converting numeric codes to characters may seem niche, yet it drives everything from simple checkmarks to industrial data exchanges. The CHAR function makes this conversion trivial, portable, and dependable. Mastering it sharpens your overall text-handling skills and unlocks creative visual solutions without bloating workbooks. Practice the examples, experiment with your favorite symbols, and explore UNICHAR for even bigger possibilities—your future dashboards, exports, and automation projects will thank you.
Related Articles
How to Show the 10 Most Common Text Values in Excel
Learn multiple Excel methods to list the 10 most frequent text values—complete with step-by-step examples, business use cases, and expert tips.
How to Abbreviate Names Or Words in Excel
Learn multiple Excel methods to abbreviate names or words with step-by-step examples and practical applications.
How to Abbreviate State Names in Excel
Learn multiple Excel methods to abbreviate state names with step-by-step examples, professional tips, and real-world applications.