Difference between revisions of "Documentation/How Tos/Calc: CONCATENATE function"
From Apache OpenOffice Wiki
< Documentation | How Tos
m |
m |
||
(9 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | __NOTOC__ | + | {{DISPLAYTITLE:CONCATENATE function}} |
+ | {{Documentation/CalcFunc TextTOC | ||
+ | |ShowPrevNext=block | ||
+ | |PrevPage=Documentation/How_Tos/Calc:_CODE_function | ||
+ | |NextPage=Documentation/How_Tos/Calc:_DOLLAR_function | ||
+ | }}__NOTOC__ | ||
== CONCATENATE == | == CONCATENATE == | ||
Line 9: | Line 14: | ||
: <tt>'''text1'''</tt> - <tt>'''text30'''</tt> may also be single cell references. | : <tt>'''text1'''</tt> - <tt>'''text30'''</tt> may also be single cell references. | ||
+ | |||
+ | : The ampersand operator <tt>'''&'''</tt> may also be used to concatenate text in a formula, without the function. | ||
=== Example: === | === Example: === | ||
<tt>'''CONCATENATE("al"; "tog"; "ether")'''</tt> | <tt>'''CONCATENATE("al"; "tog"; "ether")'''</tt> | ||
: returns <tt>'''altogether'''</tt>. | : returns <tt>'''altogether'''</tt>. | ||
+ | |||
+ | <tt>'''"al" & "tog" & "ether"'''</tt> | ||
+ | : also returns <tt>'''altogether'''</tt>. | ||
<tt>'''CONCATENATE(A1; A2)'''</tt> | <tt>'''CONCATENATE(A1; A2)'''</tt> | ||
Line 18: | Line 28: | ||
<tt>'''CONCATENATE(ROUND(RAND()*10); ROUND(RAND()*10); ROUND(RAND()*10))'''</tt> | <tt>'''CONCATENATE(ROUND(RAND()*10); ROUND(RAND()*10); ROUND(RAND()*10))'''</tt> | ||
− | : returns <tt>'''xyz'''</tt> where <tt>'''x'''</tt>, <tt>'''y'''</tt>, <tt>'''z'''</tt> are three randomly independent digits, while: | + | : returns the text string <tt>'''xyz'''</tt> where <tt>'''x'''</tt>, <tt>'''y'''</tt>, <tt>'''z'''</tt> are three randomly independent digits, while: |
:: <tt>'''REPT(ROUND(RAND()*10); 3)'''</tt> | :: <tt>'''REPT(ROUND(RAND()*10); 3)'''</tt> | ||
− | : returns <tt>'''nnn'''</tt> where <tt>'''n'''</tt> is a random digit repeated three times. | + | : returns <tt>'''nnn'''</tt> where <tt>'''n'''</tt> is a random digit repeated three times. |
+ | : Here Calc converts each number given by <tt>'''ROUND(RAND()*10))'''</tt> to text before concatenating. | ||
<tt>'''CONCATENATE("Print Date: " ; TEXT(TODAY();"dddd, d mmmm yyyy"))</tt> | <tt>'''CONCATENATE("Print Date: " ; TEXT(TODAY();"dddd, d mmmm yyyy"))</tt> | ||
− | : returns <tt>'''Print Date: Thursday, 1 January | + | : returns <tt>'''Print Date: Thursday, 1 January 2019'''</tt> (assuming today's date was Jan 1, 2019). This example serves to demonstrate that you can combine functions in quite complex ways. This example is made up of the date function <tt>'''TODAY()'''</tt> which returns the current date as a number (NOTE: Jan 1, 2019 is represented as 43466) and the text function <tt>'''TEXT()'''</tt> which allows you to format the numeric representation of the date in a [useful] textual format. |
− | {{ | + | {{SeeAlso|EN| |
* [[Documentation/How_Tos/Calc: REPT function|REPT]] | * [[Documentation/How_Tos/Calc: REPT function|REPT]] | ||