[Solved] Text and formula with space in same cell

Discuss the spreadsheet application
Locked
Kenmc
Posts: 19
Joined: Sun Jun 28, 2015 9:53 pm

[Solved] Text and formula with space in same cell

Post by Kenmc »

How do I add text and formula with space in same cell. This is what I have: ="Total" & (SUM(C7+C8)) and this is the result in the cell: Total233.7.Thank for any and all help.
Ken
Last edited by MrProgrammer on Sat Mar 08, 2025 4:55 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved]
Apache OpenOffice 4.1.1
Windows 8.1
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: text and formula with space in same cell

Post by acknak »

Greetings and welcome to the community forum!

Now don't smack yourself ...

="Total " & (SUM(C7+C8))

Also, the SUM and + are redundant; one or the other does the same job.
AOO4/LO5 • Linux • Fedora 23
Kenmc
Posts: 19
Joined: Sun Jun 28, 2015 9:53 pm

Re: text and formula with space in same cell

Post by Kenmc »

Thanks acknak,
If this is your answer
Now don't smack yourself ...

="Total " & (SUM(C7+C8))
It's the same as the one in my post.
Apache OpenOffice 4.1.1
Windows 8.1
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: text and formula with space in same cell

Post by acknak »

Not quite ...

="Total" & (SUM(C7+C8))
="Total " & (SUM(C7+C8))
AOO4/LO5 • Linux • Fedora 23
Kenmc
Posts: 19
Joined: Sun Jun 28, 2015 9:53 pm

Re: text and formula with space in same cell

Post by Kenmc »

Sorry I see the difference.
Apache OpenOffice 4.1.1
Windows 8.1
Kenmc
Posts: 19
Joined: Sun Jun 28, 2015 9:53 pm

Re: text and formula with space in same cell

Post by Kenmc »

Sorry I see the difference.
Apache OpenOffice 4.1.1
Windows 8.1
Kenmc
Posts: 19
Joined: Sun Jun 28, 2015 9:53 pm

Re: text and formula with space in same cell

Post by Kenmc »

Is there anyway to change the numerical valve to currency and make the text bold?
Apache OpenOffice 4.1.1
Windows 8.1
User avatar
Zizi64
Volunteer
Posts: 11505
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: text and formula with space in same cell

Post by Zizi64 »

Is there anyway to change the numerical valve to currency and make the text bold?
"valve" is "value" really, yes?

You can not apply different Styles (by a formula) for parts of a cell content.
But you can use two cells in a row to display this combination.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Kenmc
Posts: 19
Joined: Sun Jun 28, 2015 9:53 pm

Re: text and formula with space in same cell

Post by Kenmc »

Thank all for the help.
Apache OpenOffice 4.1.1
Windows 8.1
User avatar
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: text and formula with space in same cell

Post by RusselB »

Contrary to Tibor's post, you can get the value to appear as a formatted number by using the TEXT function.
Thus you would have something like

Code: Select all

="Total " & text(sum(c7;c8);"$###.#0")
See the help file for TEXT function and Number Format Codes
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
Kenmc
Posts: 19
Joined: Sun Jun 28, 2015 9:53 pm

Re: text and formula with space in same cell

Post by Kenmc »

Thank you
Apache OpenOffice 4.1.1
Windows 8.1
Kenmc
Posts: 19
Joined: Sun Jun 28, 2015 9:53 pm

Re: text and formula with space in same cell

Post by Kenmc »

I did a search on TEXT formatting and I could not find anything. I am new to spreadsheets.
Apache OpenOffice 4.1.1
Windows 8.1
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: text and formula with space in same cell

Post by acknak »

TEXT uses the same number format codes as the spreadsheet cells (Format > Cells > Numbers ...)

You can see a list of the codes in the online help: Help > OO Help > Index > "format codes;numbers"

They're also described in the LibreOffice help, which is available on the web: https://help.libreoffice.org/Common/Number_Format_Codes
AOO4/LO5 • Linux • Fedora 23
Kenmc
Posts: 19
Joined: Sun Jun 28, 2015 9:53 pm

Re: text and formula with space in same cell

Post by Kenmc »

Thanks,
This doesn't tell me how to make the text bold and level the numbers normal.
Apache OpenOffice 4.1.1
Windows 8.1
User avatar
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: text and formula with space in same cell

Post by RusselB »

Sorry, guess I misunderstood what you were wanting.
With your latest post I have to say that I don't think it can be done and maintain the information in a single cell.
One possibility you might try is to have the information in to separate cells, then use a concatenation operation to combine into a single cell.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
Kenmc
Posts: 19
Joined: Sun Jun 28, 2015 9:53 pm

Re: text and formula with space in same cell

Post by Kenmc »

Thanks
Apache OpenOffice 4.1.1
Windows 8.1
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: text and formula with space in same cell

Post by acknak »

Oops, I misunderstood what you mean by "format"
Kenmc wrote:... This doesn't tell me how to make the text bold and level the numbers normal.
Sorry, this is not possible.

The result of a formula can have only one text format, which will apply to the whole contents of the cell.

Only text that you enter can have complex text formatting.

If you want the label in bold and the number value not bold, you have to keep them in separate cells, as Russell already suggested.
AOO4/LO5 • Linux • Fedora 23
Kenmc
Posts: 19
Joined: Sun Jun 28, 2015 9:53 pm

Re: text and formula with space in same cell

Post by Kenmc »

Thank you again.
Apache OpenOffice 4.1.1
Windows 8.1
User avatar
keme
Volunteer
Posts: 3791
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: text and formula with space in same cell

Post by keme »

With the above approach, the cell value is text which cannot be reliably used in further calculations. (It may be useful if you want to use the entire "Total xxx" string as text, like in a mail merge context.)

The common solution is to use cell formatting instead:
  • Format - Cell..., tab Numbers.
    In the Format code field, enter: "Total: " $ # ##0.00
This way, you get the appearance you ask for within one cell, but the cell value is numerical so it can be used for further calculations. Alas, there is still no possibility to emphasize parts of what is displayed. For that you still need to split to separate cells.
Apache OO 4.1.16 and LibreOffice 25.8, mostly on Ms Windows 10 and 11.
bryan.hoffmann
Posts: 3
Joined: Sat Jan 23, 2021 12:15 pm

Re: Text and formula with space in same cell

Post by bryan.hoffmann »

Excellent - this helped enormously, thanks!
Note, to get eg 'total cost is €12' in one cell, this also works: ="total cost is €"&SUM(I31:I57)
OpenOffice 2017.24 Professional Edition Patch 0 on macOS Catalina 10.15.7
Locked