Different data with color code...

sksanjeev786

Well-known Member
Joined
Aug 5, 2020
Messages
882
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi Team

Need your support i need the data in Column F format if I get data =>5 or =<5 while calculating column different B-C

book1
ABCDEF
120212020DiffNeed in this formate Only if scores are =5> or =<-5
2
3Are nutritious2228-622 (-6)
4Helps my child lead a healthy lifestyle2430-624 (-6)
5Are a good source of nutrients and/or vitamins1715217
6Are made with natural ingredients1510515 (+5)
7Offer a good variety of flavours34191534 (+15)
8Are great tasting5245752 (+7)
9Brand I trust4343043
Sheet1
Cell Formulas
RangeFormula
D3:D9D3=B3-C3



Thanks
Sanjeev
 
Ok, how about
VBA Code:
Sub sksanjeev()
   Dim Cl As Range
   Dim x As Long
  
   For Each Cl In Range("F3", Range("F" & Rows.Count).End(xlUp))
      If Cl.Offset(, -2) >= 5 Then
         x = InStr(1, Cl.Value, "(")
         Cl.Characters(x, Len(Cl)).Font.Color = vbGreen
      ElseIf Cl.Offset(, -2) <= -5 Then
         x = InStr(1, Cl.Value, "(")
         Cl.Characters(x, Len(Cl)).Font.Color = vbRed
      End If
   Next Cl
End Sub

Thanks so much, Fluff it works very well for me :)
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,214,648
Messages
6,120,725
Members
448,987
Latest member
marion_davis

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