This blog is just a few thoughts, things I see, a way to archive the more interesting things on the NET I would like to recall in a fast way.
Tuesday, July 23, 2013
Tuesday, March 05, 2013
Comparing columns in excel
Advanced conditional formatting to the rescue
The biggest issue students have with conditional formatting is its inquiry of the cell it is located on, so you cannot color a cell according to another's value.INDIRECT to the rescue, INDIRECT is a function that allows you to write the address of the cell you wish to query and it will deliver the cells value.
So using concatenation and a few other text tricks:
CODE("A") will give me 65 which is the ascii number of A
CHAR(65) will return the char representation of the number 65 which is A
So CHAR(CODE("A")-1+2) will return B
COLUMN() returns the number of the column
ROW() returns the row number
If I am on row 3 column D (4)
Then CHAR(CODE("A")-1+COLUMN()-1)&ROW() will return 'D3'
INDIRECT('D3') will return the value of D3
So the following statement
=INDIRECT(CHAR(CODE("A")-1+COLUMN()-1)&ROW()) <> INDIRECT(CHAR(CODE("A")-1+COLUMN())&ROW())
Is actually C3 <> D3
which means return TRUE when the statement is FALSE since the conditional format requires a true/false response, the statement returns True when the format needs to change.
Labels:
COLUMN(),
conditional formatting,
excel,
INDIRECT,
ROW(),
text concatination
Subscribe to:
Posts (Atom)