can a function asign a color to a result

I have a IFS function and would like to asign different colors for each result. Is this possible?

=IFS(C5 + D5 <160,“Low”,C5+D5 >220,“Hi”,1=1,“OK”)

Conditional formatting is the most common way to accomplish this, but you can also use the STYLE() function.

… and also there are conditions in number format codes. It might be useful, simplest and fastest for up to three used colors.

I have tried the conditional formatting but as soon as I add square brackets I get a 507 error
=IFS(C2+D2 <160;[blue] “Low”;C2+D2 >220;[red] “High”,1=1;[green] “OK”)
As far as I can tell there is not a missing bracket. Is the missing #.0 signifficant in this function?
I should add I am using Ver 6.4.3.2 on Ubuntu 20.04

Number format codes are not used in formulas - they are used in cell formatting (e.g., right-click a cell and choose Format Cell then see Numbers tab; or better use cell styles).

I have tried the conditional formatting but as soon as I add square brackets I get a 507 error

=IFS(C2+D2 <160;[blue] "Low";C2+D2 >220;[red] "High",1=1;[green] "OK")

The number format codes @mikekaganski referred to do not go inside the formula, but rather in the cell formatting dialog. See menu item Format - Cells, the Numbers tab. Conditions also have to be inside square brackets.

Once you get the hang of it, using format codes can be faster than either full conditional formatting or using the STYLE() function, because you don’t need to set up a style first.

The only solution I know of that goes inside the formula is with STYLE(). This does not use the predefined format codes, but cell styles

For the formula attempt mentioned above, if you want to go the format codes path, the proper formula would be =C2+D2, and the number format code for that cell would be [BLUE][<160]"Low";[RED][>220]"High";[GREEN]"OK". That would just change display in the cell, not the cell content: you won’t be able to refer to the cell in other formulas as "if the cell contains OK", but rather “if the cell is between 160 and 220”.