How to get a partially bolded string in calc?

In column name I have a list with hundreds of strings, each one with one or more bolded words. In column grade I have their respectives grades. I want to get all names with A in grade column. But I want to preserve bolded words.

My formula is:

The result I want is this:

But I always get this:

I searched functions that get bolded text, but didn’t found any. The best I found was Concatenate and bold in libreoffice but I couldn’t figure out how to use this in order to solve my problem.

EDIT: I found something interesting here cursor - Marking parts of a cell's text as bold in Libreoffice Calc Basic? - Stack Overflow but seems like the guy did some LO Basic programming which honestly I didn’t understand a thing and he just wanted to bold the first word of the string…

EDIT2: After Liberty Belle’s answer I updated my post to better clear what I really want.

This is completely different from your original post. This is not at all what you originally asked.

VLOOKUP is overkill, at least in the example you have shown here. IF(A2="A";B2;"") is enough.

+1 Very well written question. Good example and research. There’s nothing wrong with editing the question multiple times until it is clear, and it’s good to edit the question in response to comments and answers as you have done.

Thanks for your tip and answer Jim K!

I completely disagree that’s “there’s nothing wrong with editing the question multiple times until it is clear, and it’s good to edit the question in response to comments and answers as you have done”. You wouldn’t feel that way if you had wasted your time answering it only to find out he meant something completely different. And no apology! Please don’t encourage people to be sloppy and careless with other people’s time and attention. Really.

“You wouldn’t feel that way if you had wasted your time answering it only to find out he meant something completely different.” I’ve had this happen many times before, and while it can be annoying, at the end of the day, the question gets answered and hopefully, it will help other people who come across it in the future. Sometimes it’s hard to know how to write a question to avoid misinterpretation, and the only way is to wait until someone attempts an answer and then edit the question.

It’s also important to make people feel welcome even if (especially if) they don’t have a lot of experience on how to ask questions correctly. Granted, that link is not for this site, but I hope people on this site share those values.

“And no apology!” – That seems incorrect. He wrote, “Sorry for this. When I said…” in the comment. I’m not sure what more he could have done once he realized the original question needed to be corrected.

It is impossible for cells containing formulas to be partially formatted. Only cells containing text may be partially formatted.

In the example file below, whenever the sheet content is changed, the macro will find any students with grade A and then copy the name and format to column D.

Sample file: Automatically Copy Formatting And Text.ods

Sub CellTextAndFormat(oEvent)
	If oEvent.getColumns().hasByName("D") Then Exit Sub
    oDoc = ThisComponent
    oSheet = oDoc.getSheets().getByIndex(0)
    oColumn = oSheet.getColumns().getByIndex(0)
    oRanges = oDoc.createInstance("")
    oRanges.insertByName("a", oColumn)
    oCells = oRanges.Cells.createEnumeration()
    oCells.nextElement()  ' skip headings row'
    While oCells.hasMoreElements()
        oCellGrade = oCells.nextElement()
        row = oCellGrade.CellAddress.Row
        If oCellGrade.getString() = "A" Then
            Call CopyForRow(row + 1)
            oCell = oSheet.getCellByPosition(3, row)
        End If
End Sub

CopyForRow() is based on recorded dispatcher code that copies and pastes formatted text, similar to @LibertyBelle’s answer.

For more information on LO Basic, see Andrew Pitonyak’s macro document. Part of my code was adapted from section 6.14. Display all data in a column.

Note: My first idea was to use spreadsheet formulas to determine which rows to copy. However, this added additional columns and required a more complex macro. Moving the logic to the macro proved to be better.

Thanks for such a comprehensive answer! I will try the macro you programmed and read your source on LO Basic

Copy the cells from column name and then Edit > Paste Special into the new column. In the dialog box that pops up, select Text and Formats.

image description

You would really benefit from reading the online documentation English documentation | LibreOffice Documentation - Your documentation for LibreOffice to learn the program. It will save you a lot of time in the end.

You get points for doing lots of research though!

I appreciate your answer, but it’s not really what I need. Maybe I used the wrong words to say what I really need. When I say in the title “get” I mean after an operation like vlookup etc but I think I messed things up by using copied name in one of the columns. I’ll update my post to better reflect my need.

I answered the question that was asked by you. You didn’t “use the wrong words” in your original post. You asked an entirely different question. You left out vital information. Please take the time to fully explain what your issue is before posting. I don’t appreciate wasting my time and neither does anyone else here.

Sorry for this. When I said “get” partially bolded strings I was referring to “retrieve” it including bolded words after some operation. I thought it was clear, I just perceived it was ambiguous after your answer. Or even worse, maybe a totally different question! I’m a Libreoffice user for many years and never posted any question because I always search the web the deepest I can. This time I didn’t found and posted my first question.

The official documentation itself uses “get” in the same meaning I used:
“Formulas are equations using numbers and variables to get a result.”
Source: Introduction of Chapter 7 - Using Formulas and Functions, page 192 - LibreOffice 4.1 Calc Guide, avaiable here

Again, sorry for the confusion.

Your original post said nothing about a formula to combine two different columns. You asked how to copy partial bolding from one column to another. That was all.