XL.StringFormat function: create text strings with dynamically filled placeholders

How to use StringFormat function for Excel: formula and results
XL.StringFormat function – Text function type – replaces placeholders in a specified text string with the specified values.

The function helps code some parts of the string as placeholders that are dynamically filled with any values you specify.

Before you begin, add Functions to Excel

Functions are one of the 20+ features within XLTools Add-in for Excel. Works in Excel 2019, 2016, 2013, 2010, desktop Office 365.

Get started with XLTools ribbon
– free trial gives you 14 days of full access to all features.

Syntax

=XL.StringFormat(format, arguments)
ArgumentDescription
format
[required]
The text string with placeholders
arg1, arg2, …, arg11
[optional]
The list of values that you want to fill the placeholders with. Supports up to 11 arguments.

Examples [download]

Download this spreadsheet with examples and try the function yourself.


FormulaDescription
=XL.StringFormat("Dear {0}, your Order #{1} is confirmed", A2,A3)Resulting string: Dear Paul, your Order #123 is confirmed

Placeholders are filled with arguments:
{0} = value in cell A2
{1} = value in cell A3
=XL.StringFormat("Today is week #{0} and the random number is {1}", WEEKNUM(A4),A5)Resulting string: Today is week #11 and the random number is 65

Placeholders are filled with arguments:
{0} = result of the formula WEEKNUM(A4)
{1} = value in cell A5

Any questions or suggestions?
How can we help?