Calculations are not updating

GMC The Macro Man

Board Regular
Joined
Mar 23, 2023
Messages
104
Office Version
  1. 2021
Platform
  1. Windows
Hi Team,
I'm working on Excel 2021 and I'm having an issue with a calculation that does not update automatically or even when I click on Refresh Data. The "Calculation options" is set to Automatic and the only way I can update it, is to click in the cell, move my cursor to the end of the formula and hit the return button.
This is what I am trying to do in the table below as it shows a list of user ID's that have been sent an email invitation to 9 events over different times and regions. When their email responses are received, they are transferred over to the spreadsheet and their User ID is assigned a corresponding colour, accepted =GREEN, Declined=RED..etc. (This is done manually as it's less than 200 users)
Could someone please help me to understand why this isn't updating the count.. Thanks as always

I am using the following formula to count the colours - (Is there an easier way)?
In Cell D3 I have =GetColorCount(A5:A150,D2) which I have as a VBA script

Function GetColorCount(CountRange As Range, CountColor As Range)
Dim CountColorValue As Integer
Dim TotalCount As Integer
CountColorValue = CountColor.Interior.ColorIndex
Set rCell = CountRange
For Each rCell In CountRange
If rCell.Interior.ColorIndex = CountColorValue Then
TotalCount = TotalCount + 1
End If
Next rCell
GetColorCount = TotalCount
End Function



1689849848585.png
 

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.
This is why I always tell people not to use colour as data. Changing the colour of a cell does not trigger recalculation. The best you can do with this is to make it volatile by adding:

Code:
Application.Volatile True

to the start of the function code. It will then recalculate whenever any open workbook does (eg if you press f9 or another formula updates). It still won't update just from changing a cell colour though.
 
Upvote 0
Solution
Could you not have a value in a dropdown instead, you could add conditional formatting to format the text to go the same colour as the background of the cell, so effectively chosing a value in the dropdown will change the colour of the cell.

You could then replace the whole function for counting colour with a simple COUNTIF formula.

File attached

Count Colour.xlsx
 
Upvote 0
This is why I always tell people not to use colour as data. Changing the colour of a cell does not trigger recalculation. The best you can do with this is to make it volatile by adding:

Code:
Application.Volatile True

to the start of the function code. It will then recalculate whenever any open workbook does (eg if you press f9 or another formula updates). It still won't update just from changing a cell colour though.
Cheers Rory - I know what you mean by using Colour but it's what the client wanted and I thought it would be an easy fix. Adding your code and refreshing with F9 does the trick.
Thanks again
 
Upvote 0
Could you not have a value in a dropdown instead, you could add conditional formatting to format the text to go the same colour as the background of the cell, so effectively chosing a value in the dropdown will change the colour of the cell.

You could then replace the whole function for counting colour with a simple COUNTIF formula.

File attached

Count Colour.xlsx
Cheers Georgiboy, I will look in to this to see if it's a viable option.
Thanks again
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,184
Members
452,615
Latest member
bogeys2birdies

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