Difference between revisions of "Documentation/How Tos/Calc: CONCATENATE function"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Automated text replacement %s)
m (Example:: Concatenate example using multiple functions)
Line 21: Line 21:
 
:: <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.
 +
 +
<tt>'''CONCATENATE("Print Date: " ; TEXT(TODAY();"dddd, d mmmm yyyy"))</tt>
 +
: returns <tt>'''Printed date: Thursday, 1 January 2009'''</tt> (assuming today's date was Jan 1, 2009). 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, 2009 is represented as 39814) and the text function <tt>'''TEXT()'''</tt> which allows you to format the numeric representation of the date in a [useful] textual format.
  
 
{{Documentation/SeeAlso|
 
{{Documentation/SeeAlso|

Revision as of 18:15, 13 September 2009


CONCATENATE

Combines several text strings into one string.

Syntax:

CONCATENATE(text1; text2; ... text30)

returns up to 30 text strings text1 - text30, joined together.
text1 - text30 may also be single cell references.

Example:

CONCATENATE("al"; "tog"; "ether")

returns altogether.

CONCATENATE(A1; A2)

where cell A1 contains key and cell A2 contains board returns keyboard.

CONCATENATE(ROUND(RAND()*10); ROUND(RAND()*10); ROUND(RAND()*10))

returns xyz where x, y, z are three randomly independent digits, while:
REPT(ROUND(RAND()*10); 3)
returns nnn where n is a random digit repeated three times.

CONCATENATE("Print Date: " ; TEXT(TODAY();"dddd, d mmmm yyyy"))

returns Printed date: Thursday, 1 January 2009 (assuming today's date was Jan 1, 2009). This example serves to demonstrate that you can combine functions in quite complex ways. This example is made up of the date function TODAY() which returns the current date as a number (NOTE: Jan 1, 2009 is represented as 39814) and the text function TEXT() which allows you to format the numeric representation of the date in a [useful] textual format.

Template:Documentation/SeeAlso

Personal tools