0

I want to be able to impose the formatting of a string that is part of a string concatenation within a cell formula, ideally depending on the value of another cell. Something like :

="This is " & FORMATSTRING(IF(A1,"bold", "normal"),"bold text")

Can I do this in Google sheets ? If yes, how ?

1

2 Answers 2

1

That cannot be done with a custom function, because custom functions cannot format cells. They can only return a value or an array of values that is used when evaluating the formula they are part of.

You can format cells, but not partial cell contents, with a conditional formatting custom formula rule custom formula rule like this:

=$A1

To format partial cell contents programmatically, you need a script such as formatText.

1

concat It is not very easy but it can be done without a script, taking advantage of the very high unicode code like 119808 for a bold A. See this test sheet

2
  • Hmm, after a cursory search, it is possible to do this with italics and italic bold. So it would be possible then to use a custom function. Though is it worth using these Unicode characters?
    – David Tan
    May 9, 2022 at 15:58
  • @David Tan I think it would be difficult to pilot the script based on another cell
    – Daniele
    May 9, 2022 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.