+ Reply to Thread
Results 1 to 10 of 10

INDEX to replace OFFSET

  1. #1
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    INDEX to replace OFFSET

    Hi all,

    I am trying to replace my volatile OFFSET function with a non-volatile INDEX formula, but struggling to do so. I have created a dynamic range as attribute fields in my pivot shift left and right and rows are added here and there due to added filters at the top. How can I achieve the same as below without using OFFSET?

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: INDEX to replace OFFSET

    hi there. it looks like your OFFSET can remove this step:
    MATCH("Flow Delivery",OFFSET(Pivot!$A:$A,,MATCH("Flow Delivery",Pivot!$6:$6,0)-1),0)
    if you are unsure where the headers are at, you could not possibly use the part in red above. since you already know it's at row 6, then simply:
    =OFFSET(Pivot!$A$1,6,MATCH("Flow Delivery",Pivot!$6:$6,0)-1,1000)

    to do in INDEX would be:
    =INDEX($6:$6,MATCH("Flow Delivery",Pivot!$6:$6,0)):INDEX($1:$1048576,1000,MATCH("Flow Delivery",Pivot!$6:$6,0))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: INDEX to replace OFFSET

    what if I wanted to "search" for the correct row as well? Let's say, the headers are somewhere between row 1:1 and row 10:10?

  4. #4
    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,933

    Re: INDEX to replace OFFSET

    if you change the ranges in the OFFSET from full column/rows to the potential max columns/rows you think you will need, it should speed things up (Im assuming speed is the issue here?)
    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

  5. #5
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: INDEX to replace OFFSET

    I want to remove the OFFSET altogether to have a non-volatile function. Otherwise things will constantly recalculate...

  6. #6
    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,933

    Re: INDEX to replace OFFSET

    I understand, but reducing the range will reduce the calcs

  7. #7
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: INDEX to replace OFFSET

    but not removing the constant calculation entirely, thus that won't help!

  8. #8
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: INDEX to replace OFFSET

    using a formula to find a row you are not sure where isn't going to be very efficient either. you might want to consider VBA? this code here simply finds the row and column of "Flow Delivery" using Find function (CTRL + F). it then changes your existing Named Range.
    Please Login or Register  to view this content.
    you have a few options of where to place it, depending on how your data is like. you could choose to activate:
    1. when workbook is open
    2. when "Pivot" worksheet is selected
    3. whenever you want to change it.
    4. etc.

    i will just show for option 1-3. First, press ALT + F11 to open VBE. press CTRL + R to ensure you have Project Explorer on the left.
    Option 1. Double-click ThisWorkbook on the Project Explorer. There is a dropdown near the middle named "General". find Workbook. the default on the right will become Open. Paste the code in between "Private Sub Workbook_Open()" and "End Sub", looking like this:
    Please Login or Register  to view this content.
    you can view the dropdown on the right for more options.

    Option 2. Double-click Pivot on the Project Explorer. There is a dropdown near the middle named "General". find Worksheet. the default on the right will become SelectionChange. Change it to Activate. Paste the code in between "Private Sub Worksheet_Activate()" and "End Sub", looking like this:
    Please Login or Register  to view this content.

    Option 3.[*]Choose Insert > Module[*]Edit > Paste the macro into the module that appeared with a sub name like this:
    Please Login or Register  to view this content.
    [*]Close the VBEditor[*]Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)[/list]
    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

  9. #9
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: INDEX to replace OFFSET

    Row:
    Please Login or Register  to view this content.
    column:
    Please Login or Register  to view this content.
    Ben Van Johnson

  10. #10
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: INDEX to replace OFFSET

    Thank you both!! very useful stuff!

+ 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 replace Offset() with non-volatile formulas?
    By ceeyee in forum Excel General
    Replies: 14
    Last Post: 12-06-2018, 06:40 PM
  2. Index match offset to get subsequent index values in a column
    By Andrew_Step in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2013, 02:55 PM
  3. [SOLVED] Need to replace formulaarray and offset in to other VBA code
    By vizzkid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2013, 07:18 AM
  4. Help/Advice regarding Find-->offset-->replace
    By winchester427 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-28-2012, 09:49 AM
  5. Find All and Replace Offset Value
    By mccrimmon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-25-2011, 12:56 PM
  6. Replace using Offset
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-23-2011, 03:20 PM
  7. Trying to replace Offset() with a non volatile formula
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2009, 02:09 PM

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