SOLVED

Using conditional formatting to change color of cells depending on its value with text in a cell

%3CLINGO-SUB%20id%3D%22lingo-sub-2032093%22%20slang%3D%22en-US%22%3EUsing%20conditional%20formatting%20to%20change%20color%20of%20cells%20depending%20on%20its%20value%20with%20text%20in%20a%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2032093%22%20slang%3D%22en-US%22%3EI%20am%20trying%20to%20change%20the%20color%20of%20a%20cell%20according%20to%20its%20value%20but%20there%20are%20text%20combined%20with%20it%20which%20makes%20it%20difficult.%20For%20example%2C%20instead%20of%20changing%20the%20cell%20to%20yellow%20when%20its%20in%20between%203.5%20to%205%20%2C%20I%20want%20to%20change%20the%20color%20when%20its%203.5ms%20to%205ms.%20There%20are%20strings%20combined%20with%20the%20numbers.%20I%20tried%20using%3CBR%20%2F%3E%3DI6%20%26gt%3B%3D%206%20%26amp%3B%20%22ms%22%20to%20change%20the%20cell%20to%20red%20which%20doesnt%20really%20work%20as%20values%20that%20are%206.01ms%20to%206.99ms%20and%20values%20above%2010ms%20wont%20change%20even%20though%20it%20fits%20the%20criteria.%20I%20believe%20the%20%22ms%22%20screwed%20it%20up%20but%20I%20really%20cant%20not%20have%20the%20%22ms%22%20in%20it.%3CBR%20%2F%3EIs%20there%20a%20way%20to%20compare%20values%20with%20text%20combined%20with%20it%3F%20Would%20really%20appreciate%20your%20help.%20Thanks!%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2032093%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2032178%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20conditional%20formatting%20to%20change%20color%20of%20cells%20depending%20on%20its%20value%20with%20text%20in%20a%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2032178%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F918109%22%20target%3D%22_blank%22%3E%40Jelaamii%3C%2FA%3E%26nbsp%3BPlay%20around%20with%20custom%20number%20formats%20as%20demonstrated%20in%20the%20picture%20below.%20You%20enter%20a%20number%20but%20Excel%20displays%20it%20with%20the%20%22%20ms%22%20at%20the%20end.%20But%2C%20it's%20still%20a%20number%20that%20you%20can%20use%20in%20conditional%20formatting.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-01-05%20at%2010.44.11.png%22%20style%3D%22width%3A%20346px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F244247iF6DC919D43FC872F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-01-05%20at%2010.44.11.png%22%20alt%3D%22Screenshot%202021-01-05%20at%2010.44.11.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2032179%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20conditional%20formatting%20to%20change%20color%20of%20cells%20depending%20on%20its%20value%20with%20text%20in%20a%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2032179%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F918109%22%20target%3D%22_blank%22%3E%40Jelaamii%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20that's%20always%20%22ms%22%20at%20the%20end%20you%20may%20use%20something%20like%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DREPLACE(I6%2CLEN(C16)-1%2C2%2C%22%22)*1%20%26gt%3B%3D%206%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2032372%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20conditional%20formatting%20to%20change%20color%20of%20cells%20depending%20on%20its%20value%20with%20text%20in%20a%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2032372%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%20thanks%20for%20replying.%20I%20have%20tried%20your%20suggestion%20but%20having%20this%20error%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2032401%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20conditional%20formatting%20to%20change%20color%20of%20cells%20depending%20on%20its%20value%20with%20text%20in%20a%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2032401%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%20thanks%20for%20your%20reply.%20Do%20you%20mind%20breaking%20down%20how%20does%20this%20formula%20work%3F%20I%20have%20tried%20using%20it%20but%20it%20only%20works%20if%20i%20did%20not%20input%20the%20value%20with%20%22ms%22.%20For%20example%2C%20it%20stays%20the%20same%20color%20when%20i%20input%20%226ms%22%20into%20the%20cell%20but%20it%20does%20change%20to%20red%20when%20i%20input%20only%20%226%22%3C%2FLINGO-BODY%3E
New Contributor
I am trying to change the color of a cell according to its value but there are text combined with it which makes it difficult. For example, instead of changing the cell to yellow when its in between 3.5 to 5 , I want to change the color when its 3.5ms to 5ms. There are strings combined with the numbers. I tried using
=I6 >= 6 & "ms" to change the cell to red which doesnt really work as values that are 6.01ms to 6.99ms and values above 10ms wont change even though it fits the criteria. I believe the "ms" screwed it up but I really cant not have the "ms" in it.
Is there a way to compare values with text combined with it? Would really appreciate your help. Thanks!
6 Replies

@Jelaamii Play around with custom number formats as demonstrated in the picture below. You enter a number but Excel displays it with the " ms" at the end. But, it's still a number that you can use in conditional formatting.

Screenshot 2021-01-05 at 10.44.11.png

@Jelaamii 

If that's always "ms" at the end you may use something like

=REPLACE(I6,LEN(C16)-1,2,"")*1 >= 6
@Riny_van_Eekelen thanks for replying. I have tried your suggestion but having this error
@Sergei Baklan thanks for your reply. Do you mind breaking down how does this formula work? I have tried using it but it only works if i did not input the value with "ms". For example, it stays the same color when i input "6ms" into the cell but it does change to red when i input only "6"
best response confirmed by Jelaamii (New Contributor)
Solution

@Jelaamii The " ms" part is just a format. It's not part of the cell value. Have a look at the attached file, to see what I mean.