+ Reply to Thread
Results 1 to 11 of 11

Array Formula Alternative

  1. #1
    Registered User
    Join Date
    07-29-2008
    Location
    FL
    MS-Off Ver
    XL 2007 & 2008
    Posts
    27

    Array Formula Alternative

    Hello!

    I have an array which is doing exactly what I need but it is also drastically slowing my workbook. I'm hoping someone may have an alternative solution which would not hinder calculations.

    {=SUM(IF(Circuits!$B:$B="Fiscal '09",IF(Circuits!$A:$A=$A$2,Circuits!BX:BX,0),0))}

    I have tried to make an absolute reference to Circuits!$B3:$B$283 & Circuits!$BX$3:$BX$283 but for whatever reason, the formula ceases to function properly.

    Many Thanks in Advance!

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Array Formula Alternative

    Try

    =Sumproduct(--(Circuits!$B3:$B$283="Fiscal '09"),--(Circuits!$A$3:$A$283=$A$2),Circuits!$BX$3:$BX$283)

    which is not Array-Entered (just use ENTER)...

    but not sure if it will increase perfomance.. based on how many times the formula is repeated...

    Perhaps a Pivot Table might also be appropriate and if so would definitely speed things up drastically.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Array Formula Alternative

    deleted
    already answered
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    07-29-2008
    Location
    FL
    MS-Off Ver
    XL 2007 & 2008
    Posts
    27

    Re: Array Formula Alternative

    It works if I manually enter the formula. I altered the appropriate field to be relative and attempted to drag to fill. Although the appropriate field in my formula changed, the result did not.

    =SUMPRODUCT(--(Circuits!$B:$B="Fiscal '09"),--(Circuits!$A:$A=$A3),Circuits!BX:BX)

    =SUMPRODUCT(--(Circuits!$B:$B="Fiscal '09"),--(Circuits!$A:$A=$A3),Circuits!BY:BY)

    Ideally, I need to drag to fill, down 5 rows and across 19 columns. Also, what does the double dash in the formula signify?

    Thanks again.
    Last edited by smninos; 07-15-2009 at 03:41 PM.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Array Formula Alternative

    Quote Originally Posted by smninos View Post
    It works if I manually enter the formula. I altered the appropriate field to be relative and attempted to drag to fill. Although the appropriate field in my formula changed, the result did not.... Ideally, I need to drag to fill, down 5 rows and across 19 columns.
    Check that you don't have manual calcs set:

    Go to Office Button and click Excel Options.. Select Formulas from left pane and make sure "Automatic" is set on.


    Quote Originally Posted by smninos View Post
    Also, what does the double dash in the formula signify?

    Thanks again.
    They coerce resulting arrays of TRUE/FALSE to 1/0 so sumproduct can do its math.


    Please also update your profile to identify that you are using XL2007 to make it easier for us to come up with suggestions for your version.

  6. #6
    Registered User
    Join Date
    07-29-2008
    Location
    FL
    MS-Off Ver
    XL 2007 & 2008
    Posts
    27

    Re: Array Formula Alternative

    Remembered that I had turned auto calc off due to the arrays being so slow. The suggested formula is slightly quicker although not much. I also followed your suggestion about a pivot table but I don't think this will satify the appearance of the data that is needed.
    Are these the only options I have? Either way, I really appreciate your help. Thanks

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Array Formula Alternative

    Maybe add 5 helper columns and then use Sumif.... not sure how much faster..

    e.g

    In Circuits sheet add a column with formula:

    =If(AND($B2="Fiscal '09",$A2=Sheet1$A3),"X","")

    where Sheet1 is the sheet the A3 is found.

    copied down and across 5 columns.

    Then use formula:

    =Sumif(Circuits!CC:CC,"X",Circuits!BX:BX)

    where CC:CC is the first column you added as a helper, copied down and across 5 columns.
    Last edited by NBVC; 07-15-2009 at 04:15 PM.

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Array Formula Alternative

    If you're using XL2007 why not SUMIFS ?

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Array Formula Alternative

    ... sorry that wasn't right...

    ... and yes you can use SUMIFS... not sure if that would be faster though...keep forgetting to look at version used.

    =SUMIFS(Circuits!BX:BX,Circuits!$B:$B,"Fiscal '09",Circuits!$A:$A,$A3)
    Last edited by NBVC; 07-15-2009 at 04:27 PM.

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Array Formula Alternative

    AFAIK: SUMIFS is very efficient ...

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Array Formula Alternative

    Yeah, I don't use SUMIFS much at work since only a few of us have 2007 and I am usually designing sheets for 2003 versions... so I haven't done too much "efficiency" testing.

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