Partial colour text with Excel Formula?

kgkev

Well-known Member
Joined
Jun 24, 2008
Messages
1,291
Office Version
  1. 365
Platform
  1. Windows
I am dragging some data from various sheets and presenting it on a single line
Code:
=IFERROR(VLOOKUP(H5&"|"&B5&"|"&D5,comments!$A:$B,2,FALSE)&" ("&TEXT(((VLOOKUP(H5&"|"&B5&"|"&D5,comments!$A:$D,4,FALSE))),"dd/mm/yyyy")&")",Z5)&IF(AE5<>""," //-// Picking info: "&TEXT(AE5,"dd/mm/yy")&" "&AF5,"")


If the last part contains some text I would like it to be coloured red

Code:
=IFERROR(VLOOKUP(H5&"|"&B5&"|"&D5,comments!$A:$B,2,FALSE)&" ("&TEXT(((VLOOKUP(H5&"|"&B5&"|"&D5,comments!$A:$D,4,FALSE))),"dd/mm/yyyy")&")",Z5)[COLOR=#ff0000]&IF(AE5<>""," //-// Picking info: "&TEXT(AE5,"dd/mm/yy")&" "&AF5,"")[/COLOR]

is that possible?
 
I did my test by typing for example
Code:
sdfwerf //-// Picking info: wef
and it worked but I now realise that if I type
Code:
=if(c5<>"",c5&"//-// Picking info:"&C5)
then it does not work.

Of course copy-paste value will solve the problem but you end up with a static cell.

I tried to replace
Code:
cell.value
by
Code:
application.evaluate(cell.formula)
but without success
 
Last edited:
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
A cell cannot contain both a formula and character-level formatting.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top