Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String templating in Excel (or Calc)?

Is there some kind of string templating system in Excel or OpenOffice/LibreOffice Calc? Basically I have a text template that references some other cells and want to produce the final merged result, e.g.:

My name is [A1]. 
I have been working at [A2] for [A3] years.
Welcome to you all.

(The template variables need not be cell references directly; it can be function parameters so formula copying is not a pain.)

I know about string concatenation, but it doesn't seem to support multi-line string nor C-style escape sequence like "\n", requiring me to chain CHAR(10) which becomes unwieldy:

="My name is "& A1 & CHAR(10) &
"I have been working at " & A2 & " for " & A3 & " years." & CHAR(10) &
"Welcome to you all."
like image 745
Budiman Snowman Avatar asked Sep 03 '26 03:09

Budiman Snowman


1 Answers

Actually, you are allowed to insert line breaks in a string (Alt+Enter)

Try this formula and don't forget to activate Wrap text for the cell.

="My name is "& A1 & "
I have been working at " & A2 & " for " & A3 & " years.
Welcome to you all."

Result

like image 107
FXD Avatar answered Sep 04 '26 20:09

FXD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!