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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
A cell cannot contain both a formula and character-level formatting.
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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