Good observations! Here's how to handle dates and amounts properly while removing spaces and hidden characters:
Problem recap:
- Date is showing as
45717 → This is Excel's date serial number, not formatted as a date.
- Amount has the
$ removed → Because the formula removes all spaces including $, the currency symbol is lost.
Solution:
1. Cleaning the Date column but keeping it a date
If the original date has unwanted spaces or hidden characters, clean it but keep it a proper date:
Formula (assuming date in B2):
=DATEVALUE(TRIM(CLEAN(B2)))
TRIM removes extra spaces (leading/trailing & multiple internal spaces).
CLEAN removes hidden characters.
DATEVALUE converts the text result to an Excel date serial number.
After entering this formula, format the cell as Date:
- Right-click → Format Cells → Date → pick desired format (e.g., DD/MM/YYYY)
Alternatively, you can keep it as text formatted date with:
=TEXT(DATEVALUE(TRIM(CLEAN(B2))),"dd/mm/yyyy")
This returns a date as text in the format "dd/mm/yyyy".
2. Cleaning Amount while keeping the $ symbol
Since the $ sign should stay, do not remove it.
You want to remove spaces and hidden characters except the $.
Use:
=SUBSTITUTE(SUBSTITUTE(CLEAN(C2), CHAR(160), ""), " ", "")
This will:
- Remove hidden characters (
CLEAN)
- Remove non-breaking spaces (
CHAR(160))
- Remove regular spaces
" "
- Keep
$ and , intact.
If comma usage varies (e.g., thousands separators), no problem.
If the amount is formatted as text with $, after cleaning you may want to convert it to a number for calculations.
Use (assuming cleaned text in another cell, say D2):
=VALUE(SUBSTITUTE(SUBSTITUTE(CLEAN(C2), CHAR(160), ""), " ", ""))
This converts the cleaned text to a numeric value.
Summary formulas:
| Column | Formula (assuming row 2) | Notes |
|---|
| ACCOUNT_NUMBER | =SUBSTITUTE(SUBSTITUTE(CLEAN(A2), CHAR(160), ""), " ", "") | Remove all spaces & hidden chars |
| DATE | =DATEVALUE(TRIM(CLEAN(B2))) | Format result as Date |
| AMOUNT | =SUBSTITUTE(SUBSTITUTE(CLEAN(C2), CHAR(160), ""), " ", "") | Keep $ and commas |
| DR_CR | =SUBSTITUTE(SUBSTITUTE(CLEAN(D2), CHAR(160), ""), " ", "") | Remove all spaces & hidden chars |
Optional: Formatting
- For DATE cells, set format to Date (
dd/mm/yyyy) after formula application.
- For AMOUNT cells, you can either keep the cleaned text as is or convert to number with
VALUE() and format as Currency.
If you'd like, I can help with a single formula combining cleaning and conversion for amounts too!