开发者

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.


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.


If you're using Excel 2007, you can use Conditional Formatting (a style button off of the Home tab).

  • Select the dates as a range.
  • Conditional Formatting -> New Rules.
  • Choose "Format only unique or duplicate values"
  • Format all pulldown: Choose "duplicate" values in the selected range.
  • On the Font tab, Select Bold under Font style.
  • Press OK twice.

This will bold all of the duplicated dates.

EDIT: OP really wants the first of all unique values. Here is a way to do that (without an extra column).

  • Select the second date (A2)
  • Conditional Formatting -> New Rules.
  • Choose "Use a formula to determine which cells to format"
  • Enter formula =$A2<>$A1 . The dollar signs are important.
  • On the Font tab, Select Bold under Font style.
  • Press OK twice.
  • Use the format painter to copy the Conditional Formatting from A2 to the last date.
  • Format A1 as bold, as it will always be unique.


An alternate approach is to use the following for the Conditional Formatting formula:

(A1<>INDIRECT(ADDRESS(CELL("row")-1,CELL("col"),1)))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜