+ Reply to Thread
Results 1 to 32 of 32

How to Speed Up the File Processing i.e Formulas Vs VBA ?

Hybrid View

  1. #1
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: How to Speed Up the File Processing i.e Formulas Vs VBA ?

    Hmm.. That is interesting. I never noticed that. Perhaps I have always used fixed references and never thought of the opportunity of relative references in named values. I didn't think that the cell that is calling the named range would in any way affect the named range value.

    I can see that being very useful.

    Thanks.
    Last edited by Whizbang; 10-21-2011 at 04:33 PM.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to Speed Up the File Processing i.e Formulas Vs VBA ?

    As a test of the calculation of named values, I wrote this UDF, which will return 0 if trigger ="start" or will incriment every time it is calculated otherwise.
    Function myFtn(trigger As String) As Double
        Static value As Long
        If trigger = "start" Then
            value = 0
        Else
            value = value + 1
        End If
        myFtn = value
    End Function
    Then I defined a name
    Name: myNamedFunction RefersTo: =myFtn(Sheet1!$A$1)

    Then I put =myNamedFunction in B3 and B4.

    When I put "start" in A1, both cells showed 0.
    When I then put "x" in A1, B3 showed 2 and B4 showed 1
    When I put "y" in A1, B3 and B4 became 3 and 4 respectivly.

    Apparently myNamedFunction re-cacluates each time a cell calls it.

    Clearing B3:B4,
    I put =myNamedFunction+myNamedFunction in a cell.
    "start" 0
    "x" 3
    "y" 7

    So a Name is called each time it occurs in a formula, not just once a cell.

    Use of a named range won't speed up a worksheet, but using dynamic ranges will.
    Implimenting those dynamic ranges with a Name is about the only way to go if you want to be able to edit the cell in the future.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: How to Speed Up the File Processing i.e Formulas Vs VBA ?

    Dear Whizbang AND MikeRickson,

    This thread has been so far very informative and revolutionary as I was always using the INDIRECT function and now on I can always try the INDEX function to get the Exclusive Range...

    Now I was trying to get the Range for the Sumproduct and i changed the code to this but it still gives an VALUE ERROR..

    
    =SUMPRODUCT(--(PhaseRng=MATCH(L$1,$L$1:$N$1,0)),(SQFTRng))
    
    where the PhaseRng is to be D3:D210 and then the Formula is to be used in the CELL - L2
    
    PhaseRng = =INDEX(Inventory!$D:$D,3,1):INDEX(Inventory!$D:$D,COUNTA(Inventory!$D:$D),1)
    
    SQFTRng = =INDEX(Inventory!$G:$G,3,1):INDEX(Inventory!$G:$G,COUNTA(Inventory!$G:$G),1)
    Is it because the Starting Range is D3 and the Used Range is L2..

    Warm Regards
    e4excel

+ 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