Data Analysis

TRIM Formula in Spanish: ESPACIOS in Google Sheets

Marc SeanJuly 22, 20268 min read
=ESPACIOS(A2)

It removes leading and trailing ASCII spaces and collapses repeated internal spaces to 1. It won't remove non-breaking spaces, so data copied from ERP reports, PDFs, and websites often needs =ESPACIOS(SUSTITUIR(A2;CARACTER(160);" ")) instead.

What is the Spanish TRIM formula?

ESPACIOS takes 1 text argument:

=ESPACIOS(texto)

For example:

=ESPACIOS("  Revenue - SaaS  ")

The result is Revenue - SaaS.

The function handles ordinary spaces, Unicode U+0020 with decimal code 32. A string containing 2 leading spaces, 2 trailing spaces, and 3 spaces between words is reduced to no outside padding and 1 internal space.

Google's documentation says TRIM removes “leading, trailing, and repeated spaces in text.” It also warns that non-breaking spaces are not trimmed.

Does the spreadsheet locale automatically change TRIM to ESPACIOS?

Not necessarily. In Google Sheets, spreadsheet locale and function language are related settings, but they aren't the same setting.

The locale controls items such as decimal separators, dates, currencies, and default number formatting. Function names can remain in English when Always use English function names is enabled under File > Settings. Google's documentation lists language and locale settings separately.

This distinction matters when an es-ES model uses dates such as 2026-07-31, displays €4.2M as 4,2 M€, but still accepts TRIM, SUMIFS, and VLOOKUP. Don't diagnose the workbook's formula language from its currency format.

As of July 2026, check the actual formula autocomplete before converting an entire model. If typing =ESP suggests ESPACIOS, use Spanish names. If typing =TRI suggests TRIM, the workbook is using English function names.

ESPACIOS versus TRIM

The calculation is the same. The names and, frequently, the argument separators differ.

Workbook configurationBasic formulaCHAR(160) fixTypical separator
Spanish function names=ESPACIOS(A2)=ESPACIOS(SUSTITUIR(A2;CARACTER(160);" "))Semicolon
English function names=TRIM(A2)=TRIM(SUBSTITUTE(A2,CHAR(160)," "))Comma
Excel with Spanish display language=ESPACIOS(A2)=ESPACIOS(SUSTITUIR(A2;CARACTER(160);" "))Usually semicolon
Excel with English display language=TRIM(A2)=TRIM(SUBSTITUTE(A2,CHAR(160)," "))Usually comma

The separator follows regional configuration, not the translated function name alone. Some Spanish-language workbooks accept commas, while many use semicolons because the comma is reserved as the decimal separator.

Microsoft documents the same functional limitation in Excel: TRIM was “designed to trim the 7-bit ASCII space character” and does not remove the non-breaking space character. That limitation applies equally to ESPACIOS.

Why hidden spaces break FP&A models

Extra spaces aren't a presentation defect. They change the lookup key.

Suppose a quarterly board pack pulls revenue from a P&L staging tab:

=SUMIFS('P&L'!C:C,'P&L'!B:B,">="&Assumptions!$B$3)

That date-based formula still works because it doesn't compare account labels. The failure appears when the model adds an account criterion:

=SUMIFS(
  'P&L'!$E:$E,
  'P&L'!$B:$B,">="&Assumptions!$B$3,
  'P&L'!$C:$C,Assumptions!$B$6
)

If 'P&L'!C:C contains "Revenue - SaaS " with a trailing non-breaking space, it doesn't equal "Revenue - SaaS". SUMIFS returns $0 rather than an error, potentially dropping a $4.2M revenue line from the board pack.

Spanish function names don't change that logic:

=SUMAR.SI.CONJUNTO(
  'P&L'!$E:$E;
  'P&L'!$B:$B;">="&Supuestos!$B$3;
  'P&L'!$C:$C;Supuestos!$B$6
)

A visible #N/A attracts attention. A plausible zero can survive through EBITDA, FCFF, and a returns analysis until the 14.2x exit multiple produces a valuation that doesn't tie.

Why ESPACIOS misses CHAR(160)

A normal space is U+0020, decimal code 32. A non-breaking space is U+00A0, decimal code 160. They render almost identically but remain different characters.

Non-breaking spaces commonly arrive through HTML  , PDF extraction, Word tables, and ERP report exports. ESPACIOS targets ordinary spaces, so this formula can leave the account key unchanged:

=ESPACIOS(A2)

Replace character 160 first:

=ESPACIOS(SUSTITUIR(A2;CARACTER(160);" "))

SUSTITUIR converts each non-breaking space into an ordinary space. ESPACIOS then strips the outside padding and collapses repeated internal spaces.

For an English-function workbook, use:

=TRIM(SUBSTITUTE(A2,CHAR(160)," "))

How to diagnose and clean contaminated labels

A useful audit separates detection, cleaning, and reconciliation. Burying all 3 inside a 9-condition SUMIFS makes review slower and calculation chains uglier.

1. Test the suspicious character

If the padding is at the start of the value, inspect its code:

=CODIGO(IZQUIERDA(A2;1))

A result of 32 identifies an ordinary space. A result of 160 identifies a non-breaking space.

For contamination anywhere in the cell, compare the original length with the length after removing character 160:

=LARGO(A2)<>LARGO(SUSTITUIR(A2;CARACTER(160);""))

VERDADERO means at least 1 non-breaking space was present.

2. Clean a staging column

For a 500-row trial balance export:

=ARRAYFORMULA(
  SI(A2:A500="";
    "";
    ESPACIOS(LIMPIAR(SUSTITUIR(A2:A500;CARACTER(160);" ")))
  )
)

LIMPIAR removes ASCII control characters 0 through 31. That covers embedded tabs and line feeds without needing separate replacements for each one. SUSTITUIR still has to handle character 160 because it sits outside that range.

The English-function equivalent is:

=ARRAYFORMULA(
  IF(A2:A500="",
    "",
    TRIM(CLEAN(SUBSTITUTE(A2:A500,CHAR(160)," ")))
  )
)

3. Point summary formulas at the clean key

Keep the raw account label in column A, the cleaned label in column B, and the amount in column C. Then use column B for consolidation:

=SUMIFS(
  'TB Clean'!$C$2:$C$501,
  'TB Clean'!$B$2:$B$501,
  TRIM(SUBSTITUTE(Assumptions!$B$6,CHAR(160)," "))
)

This helper-column approach is easier to audit than transforming an entire criteria range inside SUMIFS. It also avoids repeated text cleaning every time the same key feeds the P&L, balance sheet, cash flow, FCFF, and returns tabs.

4. Reconcile before replacing the raw data

Compare raw and cleaned row counts, total amounts, and distinct account counts. Cleaning 500 labels should not change a $27.8M trial balance total.

The distinct count can change legitimately when "Revenue - SaaS" and "Revenue - SaaS " collapse into 1 key. That change deserves review because the same cleanup could also merge labels that were intentionally separated by repeated internal spaces.

When ESPACIOS changes valid text

ESPACIOS collapses every run of ordinary internal spaces to 1. That's helpful for account descriptions, entity names, and vendor keys. It can be wrong for fixed-width identifiers, product descriptions where spacing carries meaning, and pasted financial statements whose alignment was encoded with spaces.

This is the non-obvious risk: a cleaning formula can fix matching while quietly changing the source's business meaning. For contribution margin by SKU, clean the display description separately from the SKU key. Don't run ESPACIOS over identifiers until you've confirmed that spaces aren't significant.

A staging tab preserves that distinction:

ColumnStored valuePurpose
ARaw ERP labelAudit trail
BClean matching keySUMIFS, XLOOKUP, joins
CRaw amountFinancial value
DContamination flagReview queue

The workbook costs more cells, but Google Sheets allows up to 10 million cells per spreadsheet. A 500-row helper column adds 500 cells, or 0.005% of that ceiling. Saving a column here isn't a serious model-design objective.

Should you clean inside SUMIFS or in a helper column?

Use a helper column when the cleaned key feeds more than 1 calculation.

ApproachBest useAuditabilityCalculation costMain risk
Clean the lookup value onlySource keys are already controlledHighLowDirty source labels remain unmatched
Transform data inside each formulaOne-off analysisLowRepeatedDense formulas and inconsistent fixes
Clean once in a staging columnBoard packs, DCFs, consolidationsHighLower across repeated useRequires an extra mapped column
Overwrite the raw labelsDisposable working fileLowLowAudit trail is lost

For a 12-tab bank syndicate DCF, staging wins. Each subsidiary's raw export remains untouched, while every downstream schedule references a documented clean key. The same pattern works for a runway sensitivity on new-hire pace or contribution margin by SKU.

For more treatment of persistent staging logic, see Google Sheets data cleaning for financial models.

Google Sheets and Excel handle formula language differently

Google Sheets can display localized function names based on its function-language setting. A workbook can therefore have a Spanish locale while retaining English names, which is common in cross-border finance teams.

Excel's interface translates many function names according to the installed display language. Formula portability is generally better when a workbook is opened normally than when formula text is pasted from documentation. Pasting =TRIM(A2) into an environment expecting =ESPACIOS(A2) can produce #ÂżNOMBRE?, while separators can trigger a parse error before Excel evaluates the function.

For shared models, document 3 items on the Assumptions tab: workbook locale, function language, and expected argument separator. That tiny control prevents someone from “repairing” a valid ESPACIOS formula into an inconsistent mix of English names and Spanish separators.

ESPACIOS is the Spanish equivalent of TRIM, but the workbook's function-language setting determines whether you actually need the translated name. It removes ordinary U+0020 spaces, not U+00A0 non-breaking spaces.

For ERP, PDF, or browser-sourced labels, the safer Spanish formula is:

=ESPACIOS(LIMPIAR(SUSTITUIR(A2;CARACTER(160);" ")))

Put it in a staging column, preserve the raw value, and point downstream formulas at the clean key. ModelMonkey can inspect the affected range, flag formula errors, and write the locale-appropriate helper formula without overwriting the raw export.

Frequently Asked Questions