Changing cell colors base on previous cell values

Josephoo

New Member
Joined
Dec 7, 2015
Messages
22
Hi

I have been researching this for a while but still can't seem to get my head around this. I have an excel sheet that does the following:

ABCDEFGHI
1P1 + P2P1P2
2702050
31397069
41395089
5

<tbody>
</tbody>

P1 and P2 have a data set that is linked to a third party app in excel. the values changes by the seconds or minutes. So E2:F4 is a dataset of changing values.

A2 is a formula that say '=E2+F2'. This is the same for A3('=E3+F3') and A4('=E4+F4') etc. I'm trying to change cell.interior.colorindex of A2 base on previous value. so example if at T0 A2 is 70 and T+1 A2 is 69. Then cell of A2 will be red. if T0 A2 is 70 and T+1 A2 is 73, A2 will change color to green. and it resets to no colors if the values say for E2 and F2 changes but T0 A2 = T+1 A2. it is smth similar to the stock board ticker where u can see green and red moving up and down. How do i account if i have a range of data say A1:D100? i dont suppose i code each and individual cell because that would just be very heavy in terms of calculations.

Any help would be appreciated. i know i have to use VBA for this as conditional formatting doesn't work. is there a way to check using arrays? i have limited programming background on this and is not too sure how i can use array to store the previous value to counter check and apply the color changes.

Thanks.

Regards,
Joseph
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,054
Latest member
juliecooper255

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top