conditional formatting in vlookup

siraj rehman

New Member
Joined
Dec 16, 2019
Messages
17
Office Version
  1. 2016
Platform
  1. Windows
conditional formatting is reading the text in vlookup and changing colour it should not happen.
=IFERROR(IF($B7>0,VLOOKUP($B7,DATA_BASE!$A$2:$B$100000,2,FALSE),""),"NOT FOUND IN DATABASE")

Range("J2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("K2").Select
Range(Selection, Selection.End(xlDown)).Select
With Application.ReplaceFormat.Interior
.PatternColorIndex = xlAutomatic
.Color = vbRed
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Selection.Replace What:="NOT FOUND IN DATABASE", Replacement:="", LookAt _
:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=True
Range("N2").Select
Range(Selection, Selection.End(xlDown)).Select
With Application.ReplaceFormat.Interior
.PatternColorIndex = xlAutomatic
.Color = vbRed
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Selection.Replace What:="+", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=True

End Sub
 

Attachments

  • Annotation 2019-12-17 225908.png
    Annotation 2019-12-17 225908.png
    119 KB · Views: 3
  • Annotation 2019-12-17 230413.png
    Annotation 2019-12-17 230413.png
    74.7 KB · Views: 3

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
CELL colour should only change if the value is "NOT FOUND IN DATABASE" else it should stay white
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,543
Members
449,316
Latest member
sravya

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