Wauvel

Excel like a finance pro.

← The library

VBA · Syntax

String concatenation

Ampersand joins text; & is safer than + because + tries to add numbers.

Very commonDifficulty 950 · Capable
Practice · 2 questions →

When to use it

The ampersand joins text. Use & rather than + because + tries to add numbers and errors on mixed types.

The code

Code
msg = "Total: " & Format(total, "0.00")

Worked examples

  • Build a message

    msg = "Total: " & Format(total, "0.00") Text plus a formatted number

    The everyday join.

  • Build a path

    path = ThisWorkbook.Path & "\" & "out.csv" A file path

    Doubled backslash is one backslash in a string.

  • Plus versus ampersand

    s = "5" + 1 ' 6 s = "5" & 1 ' "51" Plus adds, ampersand joins

    Why & is safer.

Worth knowing

  • vbNewLine inside a join breaks lines in MsgBox.
  • Join(array, ",") concatenates an array with a delimiter.
  • Building huge strings in a loop is slow; collect in an array and Join once.

Where it goes wrong

  • + with text and numbers raises type mismatch.
  • Concatenating Null gives Null.

Related

Learn the moves here — or let Wauvel run them on your numbers.

Meet your AI CFO →

One CFO-grade Excel tip a week

A short, practical email for finance operators — functions, shortcuts, and the moves that save an afternoon. Free, unsubscribe anytime.