+ Reply to Thread
Results 1 to 9 of 9

My formula runs slow when changing it.

  1. #1
    Registered User
    Join Date
    12-16-2016
    Location
    New Mexico
    MS-Off Ver
    2007
    Posts
    36

    My formula runs slow when changing it.

    I tried to change this formula from 2000 to 49999 lines to check because my report increased but it is taking for ever for excel to change these 6 values. Also when i did this it stopped counting all cells. O29 and P29 are date references FOR (029=12/01/16 P29=12/31/16). A column just equals 8568 and the rest counts the cells in I column if it is a unique number to the ones it found to be true. Did I screw up somewhere

    =SUMPRODUCT(--(JOET!$H$1:$H$49999>=O29),--(JOET!$H$1:$H$49999<=P29),--(JOET!$A$1:$A$49999=8568),--IF(JOET!$I$1:$I$49999<>0,IF(1/COUNTIF(JOET!$I$1:$I$49999,JOET!$I$1:$I$49999)=1,1,0)))

    EDIT: Here is an example of what should make the count 1.
    ---A-----B----------C----------D-----------E---------F-----------G-----------H----------I---
    8568---12/28/16---$16.44---$16.44-----$221.44---$205.00-----$205.00-----02/29/16--5628399
    Last edited by Dark0Prince; 01-11-2017 at 10:36 AM.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,477

    Re: My formula runs slow when changing it.

    It does not supprise me with counting unique distinct value and 3 criteria comparision for each row in 50000 rows!!!

    Maybe VBA could help.
    Quang PT

  3. #3
    Registered User
    Join Date
    12-16-2016
    Location
    New Mexico
    MS-Off Ver
    2007
    Posts
    36

    Re: My formula runs slow when changing it.

    Quote Originally Posted by bebo021999 View Post
    It does not supprise me with counting unique distinct value and 3 criteria comparision for each row in 50000 rows!!!

    Maybe VBA could help.
    Since my data won't be changing once it is there I'm ok with the time it takes to first compile it if it's unavoidable, but it not pulling any counts at all is a problem.

  4. #4
    Registered User
    Join Date
    12-16-2016
    Location
    New Mexico
    MS-Off Ver
    2007
    Posts
    36

    Re: My formula runs slow when changing it.

    I'm open to a VBA solution.

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: My formula runs slow when changing it.

    Quote Originally Posted by Dark0Prince View Post
    =SUMPRODUCT(--(JOET!$H$1:$H$49999>=O29),--(JOET!$H$1:$H$49999<=P29),--(JOET!$A$1:$A$49999=8568),--IF(JOET!$I$1:$I$49999<>0,IF(1/COUNTIF(JOET!$I$1:$I$49999,JOET!$I$1:$I$49999)=1,1,0)))
    What is your formula supposed to be doing?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Registered User
    Join Date
    12-16-2016
    Location
    New Mexico
    MS-Off Ver
    2007
    Posts
    36

    Re: My formula runs slow when changing it.

    =SUM(--(FREQUENCY(IF(JOET!$A$1:$A$49999=8568,IF(JOET!$H$1:$H$49999>=O41,IF(JOET!$H$1:$H$49999<=P41,JOET!$I$1:$I$49999))),JOET!$I$1:$I$49999)>0))

    Using this resolved my problem, but now i have another problem. when i import my data if i do it as text the preceding zeros come just fine. but then the formulas don't pull them up. how can I fix this and not lose the zeros on my account numbers.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: My formula runs slow when changing it.

    if you have leading zeros, then that is text, not numeric. Hard to say from your formula which part looks at that, but if it is 1 of those cell refs, then that needs to be text as well, and include all leading zeros
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: My formula runs slow when changing it.

    I couldn't get your formula to do anything but throw errors until I changed it to read this way
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  9. #9
    Registered User
    Join Date
    12-16-2016
    Location
    New Mexico
    MS-Off Ver
    2007
    Posts
    36

    Re: My formula runs slow when changing it.

    Quote Originally Posted by newdoverman View Post
    I couldn't get your formula to do anything but throw errors until I changed it to read this way
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I had to get away from sum-product because with 49999 lines to check it would lag for hours before it compiled answers for just 1 sheet.
    adding quotes to my formula allowed it to find the account numbers. "8568" eg. like that.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA code runs slow
    By jamfz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2016, 12:25 PM
  2. VBA runs slow locally, runs fine when connected remotely
    By jbzy324 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-01-2015, 10:05 PM
  3. VBA Code runs too slow
    By pezalmendra in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-31-2012, 07:19 AM
  4. Spreadsheet runs slow
    By jmoffett in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-13-2008, 02:47 PM
  5. VBA runs very slow on a Apple Computer
    By SmartbizAustralia in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2005, 09:00 PM
  6. [SOLVED] Macro runs slow
    By Sandy in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-20-2005, 12:05 PM
  7. macro runs slow
    By nanomiter in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-11-2005, 01:06 PM

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.6.0 RC 1