Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I received the error message "Excel ran out of resources while attempting to calculate one or more formulas" on ONE of my computers (Out of 2).

My worksheet contains: (Inside a single worksheet, not workbook, there are formulas in another worksheet)

  • > 1,000,000 formulas
  • a Pivot table base on 900,000 rows of data

When I run excel/vba on the action "Calculate Sheet" (The current worksheet only), the program would pop the following error message:

Excel ran out of resources while attempting to calculate one or more formulas

on neither I "refresh" a pivot table in (Excel or VBA) or "Calculate Sheet" in (Excel or VBA)

I have 2 computers:

  • both running 64 bits Windows 7,

  • both running Excel 2007 32Bit,

  • I run Excel right after starting Windows,

  • my development PC with 2GB RAM can run without problem,

  • another PC with 6GB RAM shown the ran out of resources error message

  • Running on same set of data, same excel file

I also notice that on my development PC, it is using ~ 1.2G RAM, and the non-working PC, it is using 900M RAM prior to clicking the "Refresh"/"Calculate" Action.


The Non-working Computer can handle data within 100,000 rows of data

My questions:

  1. Why it is working for the computer with less memory but not the one with more memory? (main question)
  2. What can I do to reduce the memory used by Excel? (sub question) (Other than deleting data)

Any help is appreciated, please point me into the right direction or simply give some clue.

EDIT:I am thinking of removing the formulas, and move the logic into vba, and do it by caching the data maybe per 10,000 rows. But this won't solve my problem if "refresh" pivot table would show the same error.

share|improve this question

migrated from Jan 2 '13 at 17:43

This question came from our site for professional and enthusiast programmers.

Odd that the non-working computer has more RAM. Can you verify there is enough memory free (both physical and swap) on the computer that errors out? Other than that I would say to optimize or split the sheet if possible. 1M formulas sounds a bit big for an Excel sheet? – lc. Jan 2 '13 at 10:07
Ok. Then why moving the lines to Excel ? You can set your Pivot to directly query Oracle. If the are no specify counter indication, I would play it that way. – iDevlop Jan 2 '13 at 11:23
Or even better, if your running at least Oracle 11g then it natively supports PIVOT queries, the work would then be done server side rather than locally and any resource problems should be avoided. – Matt Donnan Jan 2 '13 at 12:33
@Larry, I've run into the same problem quite few times and generally chalked it up to the 32-bit version of Excel being the issue. As to why it works on one machine over another... I'd say it's just the way the OS / install has allocated resources. The only 2 solutions I've found for this are: 1) Writing .Net solutions that do the largest part of the work, then have an excel macro call the .exe through shell and then import the already-calculated data / do minimal clean-up work. 2) LOTS of playing around with my code to try and make it more efficient / less-memory-consumptive... Good luck!!! – John Bustos Jan 2 '13 at 13:48
2 things off the top of my head to check. 1) does the 6gb machine have other programs using more memory? 2) are both excel versions EXACTLY the same (same updates, etc applied) – Pynner Jan 2 '13 at 16:47

The reason is probably differing 32-bit memory fragmentation on the 2 Pcs (its often difficult to use all of the theoretically available 2 GB).
You can reduce the amount of memory used by the pivot table by reducing the number of columns and/or reducing the memory required by some of the columns (text strings are a good candidate).
(You can measure the amount of memory used by the pivot cache with VBA PivotCache.memoryUsed)
I assume you are creating the pivot cache by reading the data from the query directly into the pivot cache rather than putting the query data onto a worksheet and basing the the pivot on the worksheet, which would use much more memory.
You don't say what the >1000000 formulas are so I don't have any suggestions for improvement for them.
If you want to use large amounts of data in Excel pivots etc you would get better results from the 64-bit version of Excel 2010 which does not have the 2-GB limit

share|improve this answer
Thanks for the suggestion, I am currently trying stuff, found a good link… – Larry Jan 3 '13 at 2:26
On the formulas part, I am not using any build-in or user-defined Volatile functions, but I am thinking of using Selection.Calculate and only select a few rows at a time. – Larry Jan 3 '13 at 2:34
up vote 1 down vote accepted

thanks for all the suggestion, readings and help. I have solved the problem by

  1. Change all formulas into values step by step per ~ 100,000 rows --- This reduce the memory held by excel by 10%
  2. Removed any unnecessary data/Worksheet(s) in the workbook (The raw data before data massaging ) --- This reduce the memory held by excel by 40%

And the reading suggest why 6G RAM PC is facing this issue rather than 2G RAM PC. I think it's because the 6G PC has a lot of excel add-in on it consuming RAM as well.

Thanks for the helps.

share|improve this answer

One possible reason why it might run out of resources on a 6GB machine, and not a 2GB machine, is that Windows itself takes more resources to manage 6GB of memory than it does to manage 2GB of memory.

It was a known problem in 32 bit Windows (and an even bigger problem in 16 bit Windows). It is supposed to be solved on 64bit systems, but...

In any case, it's possible to test: disable the extra RAM and see if the problem goes away.

share|improve this answer

old queston but still valid for all the versions, I run into similar issues when the formulas I used had too big scope even though most of the fields were empty, ex: DO_CALCULATION(D1:D100000) will take significant amount of time and memory even if only cells D1:D10 have any value. So be careful trying to make formulas ready for data expansion, keep the ranges small :)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .