Conditional format on text field?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,676
Office Version
  1. 365
Platform
  1. Windows
I have a column of text values representing the number of weeks remaining before some deadline.

[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD="align: center"]Lead Time[/TD]
[/TR]
[TR]
[TD="align: right"]25 Wks [/TD]
[/TR]
[TR]
[TD="align: right"]28 Wks [/TD]
[/TR]
[TR]
[TD="align: right"]30 Wks [/TD]
[/TR]
[TR]
[TD="align: right"]18 Wks[/TD]
[/TR]
[TR]
[TD="align: right"]35 Wks[/TD]
[/TR]
[TR]
[TD="align: right"]3 Wks[/TD]
[/TR]
[TR]
[TD="align: right"]27 Wks [/TD]
[/TR]
[TR]
[TD="align: right"]38 Wks [/TD]
[/TR]
</tbody>[/TABLE]

I would like like to highlight (fill color) the cells depending on the value. For example, set the fill to red for cells that are less than 2 wks. But these are text values, not numeric. Is there any way to do this?

It would be difficult for me to change these values to numeric.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hi,

Use B2 formula as your CF formula:


Book1
AB
1Lead Time
225 WksFALSE
328 WksFALSE
430 WksFALSE
518 WksFALSE
635 WksFALSE
73 WksFALSE
827 WksFALSE
938 WksFALSE
102 WksFALSE
111 WkTRUE
Sheet60
Cell Formulas
RangeFormula
B2=LEFT(A2,FIND(" ",A2)-1)+0<2
 
Upvote 0
Try the Use formula to determine cells to be formatted option of conditional formatting with this formula:

=TRIM(LEFT(A1,LEN(A1)-4))+0<2
 
Upvote 0
Hi,

Use B2 formula as your CF formula:
[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell
[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]B2[/TH]
[TD="align: left"]=LEFT(A2,FIND(" ",A2)-1)+0<2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Of course. Doh! It never occurred to me to extract the numeric part. Thanks
 
Upvote 0
Try the Use formula to determine cells to be formatted option of conditional formatting with this formula:

=TRIM(LEFT(A1,LEN(A1)-4))+0<2

Of course. Double doh! This works perfectly. Thanks
 
Upvote 0
You're welcome.

FYI, formula in Post #3 will error out if the value in Column A is like my sample A11 ( 1 Wk ).

Got it.

How about this?

Code:
=(SUBSTITUTE(A1," Wks","")+0)<2

It works because I know that the units will always be exactly " Wks" even if the number is "1".
 
Upvote 0
Yes, that's great if you know it'll always be " Wks"

You don't need the extra brackets thou, =SUBSTITUTE(A1," Wks","")+0<2
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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