Text
Format email with display name ("Name <email>") and extract address back out
Format a simple single-recipient display string and extract an address from a controlled angle-bracket format. This is not a complete email-header parser.
Quote a display name without altering the mailbox spelling
The formatter always quotes a nonempty display name and escapes embedded quotes and backslashes. It preserves the address spelling instead of lowercasing the local part.
The example assumes a previously validated address and a simple ASCII display name. It rejects carriage returns and line feeds. Full email-header generation also requires standards-aware handling of encoding, control characters, comments and address lists; use a mail library for sending.
The extraction formula is only for one controlled Name <address> string or a bare address. It is not suitable for arbitrary RFC headers or multiple recipients, and its fallback is not address validation.
| Display Name (A) | Email (B) | Illustrative formatted recipient | Parsed Email Back Out |
|---|---|---|---|
| Maya Chen | maya@acme.io | "Maya Chen" <maya@acme.io> | maya@acme.io |
| Chen, Maya | maya@acme.io | "Chen, Maya" <maya@acme.io> (Quoted!) | maya@acme.io |
| (blank) | ops@acme.io | ops@acme.io (Bare email) | ops@acme.io |
Format a controlled single-recipient display string
Quotes the display name; blank names return only the address. Neither branch verifies that the mailbox exists.
=IF(OR(ISNUMBER(FIND(CHAR(10),A2&B2)),ISNUMBER(FIND(CHAR(13),A2&B2))),"Invalid line break",LET(n,IF(COUNTBLANK(A2)=1,"",TRIM(A2&"")),e,TRIM(B2&""),IF(n="",e,CHAR(34)&SUBSTITUTE(SUBSTITUTE(n,CHAR(92),CHAR(92)&CHAR(92)),CHAR(34),CHAR(92)&CHAR(34))&CHAR(34)&" <"&e&">")))Extract clean email address from "<...>" header OR bare email cell
Falls back to TRIM(C2) automatically when a row contains a bare email address without angle brackets.
=IFERROR(TEXTBEFORE(TEXTAFTER(C2, "<"), ">"), TRIM(C2))Try the example
Use the original values or change them to test your understanding.