+ Reply to Thread
Results 1 to 10 of 10

rewriting formula to eliminate "offset" function

  1. #1
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    rewriting formula to eliminate "offset" function

    I've got a CPU-intensive worksheet that I'm trying to clean up.

    This is one of the formulas which I suspect is eating up resources. Rather than using the OFFSET function, how would it be written to just refer to column A to get the SUMIF calcs?

    Please Login or Register  to view this content.
    Thanks much!

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: rewriting formula to eliminate "offset" function

    What's the value of C4 ?

  3. #3
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: rewriting formula to eliminate "offset" function

    C4 is one of the inputs to the spreadsheet. It can range from 1 to 100, so I'd like to keep it as a variable.

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: rewriting formula to eliminate "offset" function

    I figured that much, I was hoping for the actual value like 10 or something so I could work out the math of the formula.
    But anyway

    The need for that to be a variable is the reason the formula is so complicated and inefficient.
    Not much you can do about it.

    You can do similar with INDIEX instead of OFFSET, but not sure it would be any better performance wise.

    You can replace each offset function
    OFFSET(B1828,(-1*$C$4)+1,-1,$C$4,1)
    with
    INDEX(A:A,ROW(B1828)-$C$4+1):A1828

  5. #5
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: rewriting formula to eliminate "offset" function

    OK, thanks. Curious, do you know if it is more efficient to create a number of columns, each with a simple formula, than to have one column (as in the example above) with a large, inefficient formula?

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: rewriting formula to eliminate "offset" function

    I lean towards using helper columns, if they make sense on a case by case basis.
    Without a full understanding of what you're doing here, it's hard to say if that would help or not.

  7. #7
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: rewriting formula to eliminate "offset" function

    OK thanks. The formula is for RSI (relative strength indicator), which is used in analyzing stock prices.

    I've attached a spreadsheet showing an alternative way to calculate it, using using columns. (even then the spreadsheet still
    uses INDEX).

    The final calculation gives you a number from 0 to 100. 50 would be a "flat" series of prices. Anything over 50 means stock is rising,
    and anything under 50 means stock is falling.
    Attached Files Attached Files

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: rewriting formula to eliminate "offset" function

    Yes, helper columns make sense here.
    Because you need the same calculation more than once per row anyway..
    You have 2 formulas (G and H) that refer to F.

    So it saves calculation time.
    If you crammed both E and F calculations into 1 formula for G, then you'd have to do the F calculation AGAIN for H.

  9. #9
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: rewriting formula to eliminate "offset" function

    OK thank you! I didn't know that. I appreciate you help.

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: rewriting formula to eliminate "offset" function

    You're welcome.

+ 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. How to eliminate "false" from this formula?
    By alex1fly in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-02-2015, 02:51 PM
  2. Replies: 4
    Last Post: 10-06-2015, 12:46 AM
  3. Rewriting a "Range" Macro to an Entire Column
    By Jsweeten in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-03-2013, 02:41 AM
  4. How Eliminate "0"s in Formula Cells
    By TomBrooklyn in forum Excel General
    Replies: 3
    Last Post: 07-31-2008, 07:34 PM
  5. [SOLVED] To block "to "eliminate" of the picture of form, information
    By Isaac in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-29-2006, 11:30 AM
  6. Replies: 0
    Last Post: 08-24-2005, 04:05 PM
  7. Replies: 2
    Last Post: 01-30-2005, 03: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