In Spreadsheet software like Google Sheets or Microsoft Office, the &
operator does 2 beautiful things:
- Converts the output of the 2 elements on either side of it as
strings
- Joins the
string
outputs
= 0 & 5 # 05
= 'con' & 'cat' # concat
It's especially useful for summary cells when you want to show 2 values in the same cell or format a value in an uncommon way that may not be built in to the spreadsheet software (or you don't feel like finding it). For example:
= SUM(A1:A10) & 'mL' # 500mL
= 'Total: ' & SUM(A1:A10) & ` | Avg: ` & AVERAGE(A1:A10) # Total: 500 | Avg: 250