excel - Highlighting cell if one date is after another? -


i have couple columns of data, , trying highlight instances second date occurs before first, show if there mistakes in data.

id  start date  end date 1    01/01/15    01/15/15 2    01/06/15    01/02/15 3    01/06/15    01/03/15 4    01/11/15    01/13/15 

i able highlight cells end date earlier start date. of date conditional formatting links have been directed basing off of current date, or 1 specific date, , kind of lost.

thanks!

this kinda complicated if have no coding experience. best way solve problem write vba script yourself. go step step process of doing complete code.

1) open excel file, go developer tab.

(if not see it, go file->options, click on customize ribbon, , add click on developer main tabs.

2) click on visual basic button, under developer tab.

3a) paste following code in:

sub colorcellswithincorrectenddate() dim rows rows = activesheet.usedrange.rows.count = 2 rows if cells(i, 2).value > cells(i, 3).value cells(i, 3).select selection.interior .pattern = xlsolid .patterncolorindex = xlautomatic .color = 65535 .tintandshade = 0 .patterntintandshade = 0 end end if next end sub

3b) code above works if excel sheet in exact same format listed above.

--if cells not in same columns, adjust numbers in "cells(i,#)" number corresponds column. (ie. a=1, b=2, c=3...). right checking column b (start date) greater column c (end date). , coloring cell c if true.

--if cells not in right row adjust line says "for = # rows" number corresponds directly row number.

--if want different color go website: http://www.w3schools.com/tags/ref_colorpicker.asp, , replace "65535" 1 of valid numbers.

4) save , exit out of visual basic

5) return excel sheet , click developer->macros. (a dialog box appear)

6) select "colorcellswithincorrectenddate" in dialog box, , click run.

7) end dates past start date highlighted in yellow (or whatever color chose)

hope helps!

-blindingfog


Comments