Extract names, emails, or codes in Excel

Autor: AILesson5 min de preparaciónProbado con:ChatGPTRevisado el: 2026-08-28

Respuesta rápida

Build a text formula from real delimiters without assuming every row has the same shape. Proporciona: Text to extract, Observed input patterns, Excel version and rules. Resultado esperado: A robust extraction formula with malformed-input checks.

1

Añade tu contexto

Tu texto permanece en este navegador. AILesson Prompts no lo envía a un modelo ni a un servidor.

2

Tu prompt

Los campos sin rellenar permanecen visibles como marcadores de posición, para que puedas copiar y editar el prompt

Create an Excel formula to extract text.

Desired result:
[goal]

Observed input patterns:
[patterns]

Excel version and exception rules:
[version]

Identify the delimiter or positional rule and test whether it is stable across the supplied values. Do not assume all names have two words or all codes have fixed length unless stated. Return a modern formula, a legacy-compatible alternative when relevant, and tests for missing delimiters, repeated delimiters, leading/trailing spaces, blanks, and non-ASCII text. Keep malformed values visibly flagged rather than silently truncating them.
Probar en Playground
Privado de forma predeterminadaLa preparación del prompt se realiza localmente en tu navegador. Evita introducir información confidencial en cualquier servicio de IA, a menos que tu organización lo permita.

De la entrada al resultado

Un ejemplo completo

Mira cómo un contexto concreto convierte esta receta en un resultado que puedes usar

Entrada real

Text to extract
From A2 values formatted as 'Full Name <email>', extract the email into B2.
Observed input patterns
Normal: Ana Pérez <ana@example.com>; Chinese name: 王小明 <xiaoming@example.cn>; leading spaces; blank; malformed value without angle brackets; one row contains two '<' characters.
Excel version and rules
Microsoft 365 supports TEXTBEFORE and TEXTAFTER. Blank input should stay blank. Any malformed value should return 'Review'.

Ejemplo de salida

The stable rule is text between one “<” and the following “>”. Because repeated delimiters are considered malformed, count them before extracting.

B2 formula =IF(TRIM(A2)="","",IF(AND(LEN(A2)-LEN(SUBSTITUTE(A2,"<",""))=1,LEN(A2)-LEN(SUBSTITUTE(A2,">",""))=1),TRIM(TEXTBEFORE(TEXTAFTER(A2,"<"),">")),"Review"))

The two length differences count opening and closing brackets. Only one of each allows extraction; TRIM removes surrounding spaces without changing accented or Chinese characters.

Legacy approach: use MID with FIND after the same bracket-count checks: TRIM(MID(A2,FIND("<",A2)+1,FIND(">",A2)-FIND("<",A2)-1)).

Tests: Ana Pérez and 王小明 return their full email addresses; blank returns blank; missing brackets and two opening brackets return Review. Also verify that “>” occurs after “<”; if reversed brackets exist in the data, add that condition before rollout.

Por qué funciona

  1. 1

    Observed patterns prevent a formula designed for one clean example from corrupting irregular rows.

  2. 2

    A visible malformed-input result makes later cleanup auditable.

Comprueba el resultado

  • Does the extraction rule rely on a delimiter that is actually stable?

  • Are missing or duplicated delimiters reported rather than misparsed?

  • Does the formula preserve accents and non-Latin characters?

Úsalo con confianza

Preguntas frecuentes

Respuestas prácticas sobre cuándo usar esta receta, qué debes proporcionar y en qué casos la revisión humana sigue siendo importante

What should I prepare before using “Extract names, emails, or codes in Excel”?

For “Extract names, emails, or codes in Excel,” prepare Text to extract, Observed input patterns, and Excel version and rules. Replace placeholders only with information you can verify. If a detail is unknown, preserve that uncertainty explicitly instead of asking the model to infer it.

When is the “Extract names, emails, or codes in Excel” result not ready to use?

The result is not ready if it does not yet deliver the stated outcome—A robust extraction formula with malformed-input checks—from the supplied evidence, or if it relies on unresolved assumptions, missing approvals, or invented details. Use the checks as release gates: revise the source inputs or assign a named, authorized reviewer instead of polishing an unsupported output.

Which AI tools have recorded tests for “Extract names, emails, or codes in Excel”?

The published test record for “Extract names, emails, or codes in Excel” lists ChatGPT as of 2026-08-28. This confirms recorded runs, not guaranteed compatibility or identical results in later product versions. For another tool or version, keep every constraint visible and repeat the result checks before use.

Más formas de explorar

Dónde encaja esta receta

Mantén el trabajo en marcha