How to add markup inside a conditional query?

Hi,

I have 2 columns in my sheet, and to save on white space when printing I decided to merge them togheter and play with the markup factor .

minimalistic example of my situation with random ages and names, not everyone has a specified age like so :

...
12 Jon
   Dean
   Phill
45 Megan
   Portia
...

The formula for the new column is simple =IF(ISBLANK(A1),B1,B1&" "&A1) .

Now the problem is : how I can formulate the conditional such that when mergin the content of A in B, the content of A gets different formatting, like for example, B keeps being a plain regular font and A is italic .

I haven’t found any reference to this kind of operations inside the libreoffice documentation .

I would also like to know how to make the result of a formula “permanent” so that I can delete the old columns from the sheet .

Thanks .

Of course, everybody has different requirements, but why? The spreadsheets’ very purpose is to contain and operate upon structured data (for which purposes, columns and rows serve) - so why try to defeat the purpose and mix data of different nature into one column?

It’s impossible to create a spreadsheet formula that has its output’s parts formatted differently in a single cell. You would need a dedicated macro for such kind of job.

To make results permanent, you need to use DataCalculateFormula To Value.

how to do that ? I’m ignorant and a beginner on this

For a hint about formatting part of a cell, see [Solved] Changing the formatting for part of a cell (View topic) • Apache OpenOffice Community Forum. For your case, you would need to create a whole macro that would first compose the cell’s content based on A and B columns (so it will write to destination a string, not a formula), and then format it.