Round() Function & Pivot Tables


New Member
Aug 14, 2003
I'm using Excel 2007...does anyone know why the the sum of values for one column in my pivot table would differ from the total sum of my linked table?

I am using the Round(Rand()*100,0) function to determine the values for each cell in this one column. I notice that these values change each time I refresh the page (not sure why it does this). It seems as if the data in the pivot table is always one refresh behind.


Table 3+4+5 = 12 (values 3, 4, and 5 are generated by the above function)
Pivot Table 2+3+4 = 9 (values 2, 3, 4 were the values found in the table before the Refresh was applied)

The pivot table should show the same values as found in the table

Thanks in advance to anyone who can help! I hope I was clear enough.

Andrew Poulsom

MrExcel MVP
Jul 21, 2002
The RAND function is volatile, so it updates each time the worksheet is calculated. Calculation doesn't automatically refresh a pivot table, that needs to be done manually. You could try this in the module for the worksheet:

Private Sub Worksheet_Calculate()
    Application.EnableEvents = False
    Application.EnableEvents = True
End Sub

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...