[Solved] Cell value in a text string

Discuss the spreadsheet application
Post Reply
User avatar
IGraham
Posts: 33
Joined: Sun Sep 12, 2010 6:11 pm

[Solved] Cell value in a text string

Post by IGraham »

how do i include a cell value in a line of text, thought it would be something like this

="attending are" & data;Q54 & " people"

but not working

anyone know the correct way ?
Last edited by IGraham on Sat Feb 26, 2011 6:21 pm, edited 2 times in total.
LibreOffice 3.5.1.2 on W7 64x
User avatar
Hagar Delest
Moderator
Posts: 30523
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Cell value in a text string

Post by Hagar Delest »

Why not just:
="attending are" & Q54 & " people"

If it doesn't work, can you upload a sample file (see How to attach a document here)?

Please add '[Solved]' at the beginning of your first post title (edit button) if your issue has been fixed.
LibreOffice 7.2.6 on Xubuntu 22.04 and 7.2.6 portable on Windows 10
User avatar
IGraham
Posts: 33
Joined: Sun Sep 12, 2010 6:11 pm

Re: Cell value in a text string

Post by IGraham »

and there was me going more and more complex

thanks
LibreOffice 3.5.1.2 on W7 64x
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Solved] Cell value in a text string

Post by acknak »

and there was me going more and more complex
You were on the right track, I think.

Although it's not needed in the simplest case, it's often handy to use the TEXT function to apply a specific format when the value is inserted:
="attending are " & TEXT(Q54;"0") & " people" gives attending are 27 people, rounding the value to the nearest integer. The format code here is "0"; you can see the format codes when you use the Format > Cells > Numbers dialog: look near the bottom of the dialog window.

Another approach can be useful if you need the value to be displayed as part of some longer text, but still be available for calculations. In that case, you can add the text directly as part of a custom number format, under Format > Cells > Numbers, with something like:
"attending are" 0 "people". The number format code, 0, will show the rounded value when the cell is displayed, with the text on either side.
AOO4/LO5 • Linux • Fedora 23
Post Reply