Question

I have an Excel spreadsheet that is tracking the daily weight measurements for several birds. I have conditional formatting set up so that the color of the cell changes if the weight for that day is below a certain threshold (actually, there are three thresholds, with corresponding color changes). However, gross weight is only one factor here, the weight change from one day to the next is very important for keeping track of the health of the birds.

The problem I am having is that this is a dynamic range. That is, I don't have fixed cells. I can't just point to two cells and tell it to calculate the difference; each day the range is going to change (that is, today the difference would be between C4 and C3, but tomorrow it will be between C5 and C4, then C6 and C5, etc.). Each day data is entered in a new cell in the column and I want calculation to be based on the preceding cell.

Is there a way in Excel to use conditional formatting so that if the difference between two values exceeds a given amount (in this case, 1 is sufficient) it changes color, or do I need to use VBA?

Was it helpful?

Solution

No need for VBA and much better to do as @Tim suggests, but if you insist!:

Select C3 and set the rule (in Use a formula to determine which cells to format)

=ABS(C3-C2)>1

(1 is your chosen materiality, assumed plus or minus) and for the range (Applies to) make sure you start at C3 (assuming you have a header row and your data starts in C2), eg

=$C$3:$C$1000 or up the '1000' to however many required.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top