Link to home
Start Free TrialLog in
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
Avatar of Rgonzo1971
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
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A solution