I have a workbook with two sheets. I would like to format the cell background color in the first column of sheet 1 based on the values in the second column of sheet 2.
For example, if the value of of sheet2, row 6, column 2 is say, 4, then I would like the background color of sheet 1, row 4, column 1 to be green. If none of the values in sheet 2, column 2 reference a particlar row in sheet 1, I’d like to leave it set to no color. There’s no prohibition against the same value appearing multiple times in the second column of sheet 2. Bonus kudos if you can tell me how to unset the color if the last value in sheet 2 pointing to a row in sheet 1 is removed.
I’m sure that for the Excel wizards out there this could be trivial, but I rarely have occasion to use excel and certainly don’t have time to become a black belt in it. Can anyone offer me advice, pointers, or a quick formula to do this? If this is going to take some complex VB code to implement, it isn’t worth it.
Thank you!
Here’s how I did it in Excel 2003 using conditional formatting.
To apply conditional formatting to
Sheet1using values fromSheet2, you need to mirror the values intoSheet1.Creating a mirror of Sheet2, column B in Sheet 1
Sheet1.Enter the following formula into A1:
=IF(ISBLANK(Sheet2!B1),'',Sheet2!B1)A1by right-clicking it and selecting ‘Copy‘.Aby right-clicking its header and selecting ‘Paste‘.Sheet1, columnAshould now exactly mirror the values inSheet2, columnB.(Note: if you don’t like it in column
A, it works just as well to have it in columnZor anywhere else.)Applying the conditional formatting
Sheet1.Bby left-clicking its header.Format > Conditional Formatting...Change
Condition 1to ‘Formula is‘ and enter this formula:=MATCH(B1,$A:$A,0)Click the
Format...button and select a green background.You should now see the green background applied to the matching cells in
Sheet1.Hiding the mirror column
Sheet1.Aand select ‘Hide‘.This should automatically update
Sheet1whenever anything inSheet2is changed.