+ Reply to Thread
Results 1 to 7 of 7

simplyfing formua which uses offset and abs

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

    simplyfing formua which uses offset and abs

    I've attached a small example of a formula (relative strength indicator) which I found on the net.

    The formula (in column B) uses an average period (cell D3) to calculate the relative strength of the changes shown in column A, normalized as a scale between 0 and 100.

    But... when I added this formula to my workbook, it slows it down considerably and I'm not sure why. (the slowing down is made evident when using Solver to run through iterations which involve several formulas including this one)

    It seems that the same results could be obtained using something other than indirect (and/or abs)

    Any suggestions?

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: simplyfing formua which uses offset and abs

    Try

    =100-100/(1+(SUMIF($A4:INDEX($A4:$A$1000,$D$3),">=0")/$D$3)/ABS((SUMIF($A4:INDEX($A4:$A$1000,$D$3),"<0")/$D$3)))

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

    Re: simplyfing formua which uses offset and abs

    Thanks! That works.

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: simplyfing formua which uses offset and abs

    Hi all. @JohnTopley, with respect, your formula in post#2 fails if the value in D3 changes. Try this (in B4 and copied down):
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by leelnich; 09-25-2017 at 03:30 PM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

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

    Re: simplyfing formua which uses offset and abs

    Hi, Lee, thanks for catching that. Yes, D3 is a variable in the overall scheme of my workbook, so this will help.

  6. #6
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: simplyfing formua which uses offset and abs

    We're happy to be of service. Both solutions replaced the volatile OFFSET function with the non-volatile INDEX function. I'm sure John is as curious as I about the effectiveness of this approach. Please let us know if you calculation speed improves.
    ps My formula also added a test for fitness and removed some extraneous math. Overall, the extra function calls may have a NEGATIVE impact.
    Last edited by leelnich; 09-25-2017 at 04:06 PM.

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

    Re: simplyfing formua which uses offset and abs

    Sure, will let you know. I'll try to do an empirical test: see how many iterations Solver does per minute on the original formula vs yours.

+ 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. [SOLVED] Tweaking SUMPRODUCT formua to include SUBTOTAL
    By chilli76 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-17-2017, 08:16 AM
  2. [SOLVED] Indirect and substitute formua with sumifs
    By EmilyB in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-17-2014, 08:56 PM
  3. [SOLVED] Simple IF formua for searching for a word in a cell
    By Virtuallynne in forum Excel General
    Replies: 5
    Last Post: 05-10-2012, 08:01 AM
  4. SumIf Formua with two criteria
    By Gambinus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2011, 04:51 PM
  5. a formua to paste words in front of nos.
    By Ajitrv in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-19-2007, 09:04 AM
  6. Simplyfing code
    By oakman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-19-2007, 03:06 PM
  7. [SOLVED] need a formua for wages
    By pgc in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-18-2005, 07:05 AM

Tags for this Thread

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