change colour based on specific text.

Geek Girl 007

Board Regular
Joined
Mar 12, 2022
Messages
152
Office Version
  1. 2021
Platform
  1. Windows
I have asked this question before, however that was based on a single factor, I want to write a formula that has quite a big field.
I want any number that starts with a C (1 to 3) and is between 11 and 27 and any that starts with C4 to change colour.
Can this be done???

C-1-020
C-1-019
C-1-018
C-1-014
C-1-011
C-1-009
C-1-008
C-2-029
C-2-028
C-2-026
C-2-024
C-4-021
C-4-013
C-4-012
C-4-010
C-4-004
C-4-002
C-3-037
C-3-036
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Is there always a dash between the letter and numbers?
so examples of ones you'd want to colour?

C-1-021
C-2-012
C-3-456
C-4-654
C-11-871
C-27-111
 
Upvote 0
Hi there,
Yes, that's the way the numbers are generated, is that an issue???
 
Upvote 0
Try:
Book1
A
1C-1-020
2C-1-019
3C-1-018
4C-1-014
5C-1-011
6C-1-009
7C-1-008
8C-2-029
9C-2-028
10C-2-026
11C-2-024
12C-4-021
13C-4-013
14C-4-012
15C-4-010
16C-4-004
17C-4-002
18C-3-037
19C-3-036
Sheet2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:A19Expression=LET(t,MID(A1,3,1),ta,--MID(A1,5,3),IF(--t=4,1,(ta>=11)*(ta<=27)*SEARCH(t,"123")))textNO
 
Upvote 0
Hey, this is great, but I feel I forgot to mention that there are other letters in the pile.... so sorry.

G-1-009
H-4-004
D-2-023
G-3-003
C-1-007
H-4-015
C-2-028
D-1-002
H-4-003
H-4-026
A-3-043
A-3-043
K-4-016
A-4-034
G-4-013
C-2-013
C-3-018
D-3-017
A-2-035
D-3-025
B-2-036
 
Upvote 0
Book1
A
1C-1-020
2C-1-019
3C-1-018
4C-1-014
5C-1-011
6C-1-009
7C-1-008
8C-2-029
9C-2-028
10C-2-026
11C-2-024
12C-4-021
13C-4-013
14C-4-012
15G-4-010
16C-4-004
17C-4-002
18C-3-037
19C-3-036
20G-1-009
21G-1-009
22H-4-004
23D-2-023
24G-3-003
25C-1-007
26H-4-015
27C-2-028
28D-1-002
29H-4-003
30H-4-026
31A-3-043
32A-3-043
33K-4-016
34A-4-034
35G-4-013
36C-2-013
37C-3-018
38D-3-017
39A-2-035
40D-3-025
41B-2-036
Sheet2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:A41Expression=LET(t,MID(A1,3,1),ta,--MID(A1,5,3),IF(LEFT(A1,1)<>"C",0,IF(--t=4,1,(ta>=11)*(ta<=27)*SEARCH(t,"123"))))textNO
 
Upvote 0
Solution

Forum statistics

Threads
1,223,931
Messages
6,175,465
Members
452,646
Latest member
tudou

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