Avatar of Umesh Kadam
Umesh Kadam
 asked on

excel query

Hi,

Need help to create formula to color single number from Cell B which Matches from Cell A.
Cell B will be having many numbers in it with separated by coma (;) symbol.

Help will be appreciated for this.

Cell A       Cell B
14               13,14,21,22,23
27               16,27
28               16,17,27,28,29
16               16,27,28
Microsoft ExcelVisual Basic ClassicMicrosoft Office

Avatar of undefined
Last Comment
Rgonzo1971

8/22/2022 - Mon
Rgonzo1971

Hi,

you cannot do it with a formula but VBA

Sub macro()

For Each c In Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
    aArray = Split(c.Offset(, 1), ",")
    For Each Item In aArray
        If Item = c.Text Then
            pos = InStr(1, c.Offset(, 1), Item)
            Ln = Len(Item)
            c.Offset(, 1).Characters(pos, Ln).Font.Color = vbRed
        End If
    Next
Next
End Sub

Open in new window

Regards
ASKER CERTIFIED SOLUTION
Rgonzo1971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Rgonzo1971

A solution
Your help has saved me hundreds of hours of internet surfing.
fblack61