Search code examples
excelworksheet-function

How to format a cell based on the the cell above it?


I have a list of dates in ascending order, with quite a few duplicates, and I want to bold the first one of every unique date. (e.g. May 1st, May 1st, May 2nd, May 3rd, May 3rd)

I wanted to bold another column based on the last unique one in this one and was able to achieve it after a little research by simply using the formula =$A1 < $A2. That idea doesn't seem to work here though as =$A1 > $A0 gives an error message. How do you do this?

Edit: I'm using Excel 2007.


Solution

  • Assume the dates are contained in the cells A2, A3, A4... (due to the nature of the formula we need a header line and thus A1 is not in the range). The column you want to format is column B.

    • select cells B2 to B?
    • capture conditional formatting with formula =$A2<>$A1

    Now only the first unique line (based on criterion in column A) is formatted differently.