Using More CPU Power when Calculating

by Allen Wyatt
(last updated December 15, 2018)

7

Geoff has noticed that when calculating, Excel's CPU usage peaks at 50%. He wonders if there is any way to break through this barrier. He has tried setting Application.MultiThreadedCalculation.ThreadCount to various values, and has been able to bend the 50% limit out to about 58%, but there is still a large amount of untapped processing power available.

One way to change how much of your system resources are devoted to a particular task (such as running Excel) is to modify the importance placed on the task by the operating system. You can do this by displaying the Task Manager, right-clicking the Excel.exe process, and then choosing Set Priority. (Excel.exe is found in the Details tab of Task Manager with Windows 8 and Windows 10.)You will see six priority options available; Excel.exe is most likely set at a "Normal" priority level. You can increase the resources allocated to Excel.exe by the operating system by choosing either "Above Normal" or "High."

Note that you could also choose "Realtime," but this choice is not recommended. Why? Because then Windows will give precedence to Excel.exe at the expense of every other process on your system, including those processes used by the operating system itself. Essentially, this setting means that absolutely nothing else on your system can interrupt Excel. Sounds great, right? It can actually be a recipe for disaster because if Excel goes into an infinite loop or it takes inordinately long to finish some task (such as calculating a huge workbook), your entire system could lock up and you would be forced to reboot it.

Running at Realtime priority can also starve other system processes and prevent necessary system maintenance. Fortunately, it's rare that Excel will hold the CPU very long, so in most cases there won't be any adverse side effects, but nobody should ever boost any process to Realtime priority that's not explicitly designed for it.

Even if you were to boost Excel's priority to Realtime, you might not be able to get more than 50% usage. This is especially true if your machine has multiple CPUs or a multi-core CPU. How your system utilizes those additional CPUs (real or virtual) depends on several factors, the most important being the way in which the program (in this case Excel) is programmed to take advantage of threading on multiple CPUs. (Fortunately modern versions of Excel take advantage of multithreading opportunities very nicely.)

If you want to know more about how Excel uses memory, you can find detailed information at this helpful page:

http://www.decisionmodels.com/memlimitsc.htm

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11056) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Replacing Random Text with Your Own Text

Word includes a little-known function that allows you to put "filler text" into your document. If you want this function ...

Discover More

Printing Very Large Paper Sizes

Need to print on large pieces of paper? Word has a limit on the size of the paper it can use, but that might not be the ...

Discover More

Enabling Safe Mode

Safe Mode is an essential way to regain control of a system that fails to fully boot. Windows 10 doesn't come with a way ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Relative Worksheet References

Copy a formula from one place to another and Excel helpfully adjusts the cell references within the formula. That is, it ...

Discover More

Selecting Multiple Cells by Mistake

Click on a cell and you expect the single cell to be selected. If you instead get a group of cells, it can be frustrating ...

Discover More

Slowing Down Mouse Selection

Ever tried to select a range of cells using the mouse, only to have the cells scroll by so quickly you can't make the ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is one more than 8?

2018-12-19 18:21:53

Ron

Thanks for the update. You surprised me. As I said, I didn't think it could be done.


2018-12-19 06:15:25

Ken Varley

Answered my own question

I found the answer in Mr Excel, copied the code but had to add the DIMS . Then it worked.

The following code is activated from AUTO_OPEN when opening my Excel dashboard and gives a HIGHER PRIORITY to Excel from that point unless Excel is closed down again.

------------------------------------------------------------------------------

Sub SetPriority()
'copied from https://www.mrexcel.com/forum/excel-questions/438142-set-priority-shell-command-vba.html
'dim line added by kjv

Const ABOVE_NORMAL = 32768
Const HIGH = 128

Dim strComputer, objWMIService, colProcesses, objProcess

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'excel.exe'")
For Each objProcess In colProcesses
objProcess.SetPriority (HIGH)
Next

End Sub


2018-12-18 07:58:53

Ken Varley

Ron

Is there possibly a macro that could change the priority. It could be entered into Auto_open and therefore be invoked every time excel is used ?


2018-12-17 16:22:08

Ron

Ken:
AFIK, there is no way to permanently change process priority in WIndows (but I could be wrong). I do know that there are some utilities you can use to do that for example the free and paid versions of Process Lasso, https://bitsum.com/?discount=BITSUM-40-OFF

Geof:
I just realized you are probably maxing out 1 of 2 available cores in your computer. The simplest way to verify that is start task manager. Go to the Performance tab. There is a summary of your hardware. I expect one of the entries will say "Logical Processors: 2". Excel will be running one of the the 2 processors at full capacity.


2018-12-17 05:43:47

Ken Varley

I tried this, but after closing Excel and reopening, I found that it had returned to NORMAL priority.

As i use Excel for most things, I want it to remain as ABOVE NORMAL by default. can this be done ?


2018-12-16 15:42:21

Jim

I tried resetting the priority of my Surface Pro 3 as suggested in this tip...interestingly, when I increase the priority to AboveNormal and High, my benchmark of about 300 million calculations actually runs nearly the same or more slowly.


2018-12-15 06:27:56

Ron

Actually, you missed the easiest way to increase CPU Cycles. Turn on the option to allow "multi-threading".

This doesn't work all the time, but when it does it can be a big help. Modern computers pretty much all have either "multiple CPU's" and or 'hyperthreading" as well as "multi-tasking". For several years high end consumer computers were limited to 4 or 8 physical cores. Recently AMD released consumer chips with up to 32 physical cores, starting a new "core" race between them and Intel, the other chip maker.

The ultimate expression of "multiprocessing" in the consumer market are special dedicated "GPU" chips. This are the chips used on video addon cards. They can have thousands of cores! This is because displaying a picture on screen can depend on thousands of identical calculations that can be done all at the same time to improve video display performance.

The ultimate expression of industrial multiprocessing is the "super computer". They specialize in calculations that can be done in parallel (like weather forecasting/simulation), and they need LOTS of parallel calculations. For the last decade or more these super computers have been built of of thousands of high end consumer/business class computers. But lately, many super computers have started adding LOTS of "GPU's" because they are already explicitly designed to do parallel processing. So a single video card is equivalent to LOTS of standard computers.

Originally computers were built with a single "core", that could do only one "thing", one program, at a time. Programmers quickly recognized that meant that the computer was sitting idle ("twiddling it's thumbs") most of the time, waiting for new requests or even just waiting to read "stuff" it needs from the hard drive (which is infinitely slower than the CPU). So they added "mult-tasking". That means that you can ask the computer to do multiple things "at the same time" and it will schedule them to run one after the other every time the current task pauses. So it runs a piece of one program until it has to wait for a read request to the Hard Drive, then it will start the next task in its "queue".

Next, the simplest "brute force" fix to give a computer more CPU cycles to work with was to simply add another "core" to the chip" (or another chip). So now the computer could work on 2 or more things at the same time. This is called multi-processors.

Finally, with some more advanced programming, they were able to trick the core into thinking it was twins, so that the computer thinks that one physical core is two. This is called "hyperthreading".

The simplest example of all three concepts is a computer chip with 2 physical cores and hyperthreading. It can work on 4 separate tasks at exactly the same time. So this computer has "4 logical cores". Plus, using multi-tasking each of those 4 logical cores can run multiple tasks, rapidly interleaved.

Originally Excel was designed to run on the single core. Later they had to add a special option to tell excel that it is allowed to split it's work out among more than one logical core to work at the same time.

You can find this option in
File menu > Options command > Advanced option > Formulas section > Enable Multi-threaded calculation option
The simplest variation is to tell Excel to allow to use all of the logical processors on the computer.

The thing is that this option will not work all of the time. Some calculations have to be done in a single, logical "thread" of operations, one after the other. But some calculations can be split into separate threads to work all at the same time. But like most things in Windows, there often is more than one way to do specific things in Excel. Some excel commands force it to use a "single thread". But you can often use "newer" commands that know how to allow excel to split the underlying operation into multiple, parallel, threads. So you may have to "optimize" your formulas to use explicitly avoid using single threaded commands.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.