+ Reply to Thread
Results 1 to 5 of 5

Thread: Shorten formula to avoid maxing of CPU??

  1. #1
    Registered User
    Join Date
    08-19-2011
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    6

    Shorten formula to avoid maxing of CPU??

    I would love to know if this formula can be shortened and if so will it stop the maxxing of my computers CPU when i enter data?I have an excel spreadsheet and the sheets are Preliminaries,Baseworks,Frame,Enclosed,Fixing,Practical Completion, The below formula allows me to in each of these sheets select a supplier for a product from a drop down menu and when the supplier is entered into the target cell (A42 in this case). I then have a list of suppliers and this formula next to each, allowing me to create a list of how much will be spent at each supplier on this project.


    =SUM(IF(Preliminaries!C:C=A42,Preliminaries!G:G,0))+SUM(IF(Baseworks!C:C=A42,Baseworks!G:G,0))+SUM(I F(Frame!C:C=A42,Frame!G:G,0))+SUM(IF('Enclosed '!C:C=A42,'Enclosed '!G:G,0))+SUM(IF(Fixing!C:C=A42,Fixing!G:G,0))+SUM(IF('Practical Completion'!C:C=A42,'Practical Completion'!G:G,0))

    I have tried

    =SUM(IF(Preliminaries:Baseworks!C:C=A43,Preliminaries:Baseworks!G:G,0))

    and it wont work. Is this formuloa shotenable and will it reduce the CPU eat up or is that just the fact that there is in excess of 150 rows of data in each sheet?

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: Shorten formula to avoid maxing of CPU??

    Hi constructionssheets and welcome to the forum,

    When you use the entire column in a formula it takes longer. In your formulas you have "C:C" and "G:G" asking about the entire column.

    I'd try to shorten this range. Instead of "C:C" try using "C1:C100" (thinking there will always be less than 100 rows in your data). Do the same for all whole column ranges and see if that speeds things up.

    I hope it does.
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  3. #3
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: Shorten formula to avoid maxing of CPU??

    Well, shortening up the formula is possible... I created a list of your included sheets, gave the range of cells highlighted a "name" of MySheets (See Insert > Name > Define), then used a 3D SUMIF() formula in place of yours...

    =SUM(SUMIF(INDIRECT("'" & MySheets & "'!C1:C300"), "=" & A2, INDIRECT("'" & MySheets & "'!G1:G300")))

    ...confirmed with CTRL-SHIFT-ENTER

    This may be faster because I'm only using 300 rows, not a million, per sheet.

    EDIT: This sat unposted for over an hour on my computer, sorry for the delay. Hat-tip to Marvin...
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  4. #4
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: Shorten formula to avoid maxing of CPU??

    Reducing the Precedent Range is only really relevant if you need to use an Array which in this instance you don't.

    =SUMIF(Preliminaries!C:C,A42,Preliminaries!G:G)+SUMIF(Baseworks!C:C,A42,Baseworks!G:G)+SUMIF(Frame!C:C,A42,Frame!G:G)+SUMIF('Enclosed '!C:C,A42,'Enclosed '!G:G)+SUMIF(Fixing!C:C,A42,Fixing!G:G)+SUMIF('Practical Completion'!C:C,A42,'Practical Completion'!G:G)
    The length of a formula is not directly related to it's subsequent performance. As JB would concede the 3D SUMIF approach though "shorter" is less efficient than the above (and Volatile)

  5. #5
    Registered User
    Join Date
    08-19-2011
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Shorten formula to avoid maxing of CPU??

    Thanks a million, Exactly the solution i needed. Briliant

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0