+ Reply to Thread
Results 1 to 14 of 14

Simpler formula to handle nested OFFSET function

  1. #1
    Registered User
    Join Date
    05-04-2018
    Location
    Hong Kong
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    69

    Simpler formula to handle nested OFFSET function

    Hi

    Please refer to the enclosed file which makes use of nested OFFSET function.
    In other words, an OFFSET function makes use of output from another OFFSET function.
    One layer building upon the other.

    The file is a simplified scenario.
    In real life, things get a little complicated when working with many parameters.
    So we are trying to see if there are a simpler formula to achieve our objective.

    Thanks for the advice and feel free if you would like to suggest altogether different formulas.
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Simpler formula to handle nested OFFSET function

    Please insert row 46

    C47 drag donw
    =MATCH(D$43,INDEX(D$3:D$42,MATCH(C$43,C$3:C$42,)+SUM(C$46:C46)+ROWS(C$46:C46)):D$42,0)-1
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    05-04-2018
    Location
    Hong Kong
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    69

    Re: Simpler formula to handle nested OFFSET function

    Dear Sir

    The formular work perfectly when there is only one number on the other side to compare.
    However, as the readings are continuously updated, sooner or later there will be more than one reading.
    Sorry I did not make this clear in the beginning, but this is the reason the original formula used OFFSET function to avoid counting from top-down.
    I illustrate this in the second scenario in the enclosed worksheet.
    If there are any further input, it will be most welcome.
    Thanks for help so far!
    Attached Files Attached Files

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Simpler formula to handle nested OFFSET function

    Please try at F47

    =IFERROR(MATCH(G$43,INDEX(G$3:G$42,MATCH(2,INDEX(1/(F$3:F$42=F$43),))+SUM(F$46:F46)+ROWS(F$46:F46)):G$42,0)-1,"")

    Offset is a volatile function that recalculates every time anything change, Try to avoid if possible.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-04-2018
    Location
    Hong Kong
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    69

    Re: Simpler formula to handle nested OFFSET function

    Thank you sir!
    I need more time to test it on real data but the formula seem to work well.

  6. #6
    Registered User
    Join Date
    05-04-2018
    Location
    Hong Kong
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    69

    Re: Simpler formula to handle nested OFFSET function

    Sorry sir, I found an issue with the formula upon some testing
    I am describting in the enclosed file
    If you have any advice, would appreciate it
    Attached Files Attached Files

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Simpler formula to handle nested OFFSET function

    Quote Originally Posted by Bo_Ry View Post
    Please try at F47
    =IFERROR(MATCH(G$43,INDEX(G$3:G$42,MATCH(2,INDEX(1/(F$3:F$42=F$43),))+SUM(F$46:F46)+ROWS(F$46:F46)):G$42,0)-1,"")

    D52
    change
    =MATCH(D48,INDEX(D3:D42,MATCH(2,INDEX(1/(C3:C42=C48),))+SUM(C51:C51)+ROWS(C51:C51)):D42,0)-1
    To
    =MATCH(D$48,INDEX(D$3:D$47,MATCH(2,INDEX(1/(C$3:C$47=C$48),))+SUM(C$51:C51)+ROWS(C$51:C51)):D$47,0)-1
    Please don't remove "$" you can't drag down without "$". and adjust last refence to last row of data.

    If you want to insert rows from before.
    Select row 42 and press Ctrl + , formula will auto change reference.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Simpler formula to handle nested OFFSET function

    In E46 then drag down
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  9. #9
    Registered User
    Join Date
    05-04-2018
    Location
    Hong Kong
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    69

    Re: Simpler formula to handle nested OFFSET function

    Sorry sir, I did not explain myself clearly.
    The latest row of data in the example tab "After" being Row 47
    New readings are added every week, so in a couple of weeks, new rows will be added below Row 47 (like Row 48, Row 49,Row 50, and so on...)
    However, even if we remove the "$" sign, when new roles are added, the formular continues to reference to Row 47 only (rather than the latest set of Row 50, etc.)
    I explain in the "3 more rows added' tab in enclosed file.
    Attached Files Attached Files

  10. #10
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Simpler formula to handle nested OFFSET function

    Please try again

    C53
    =MATCH(D$49,INDEX(D$3:D$48,MATCH(2,INDEX(1/(C$3:C$48=C$49),))+SUM(C$52:C52)+ROWS(C$52:C52)):D$48,0)-1

    Select row 48 and press Ctrl + for insert row

    5 more rows added sheet are result when insert 5 rows at row 48
    C58 automatic change to
    =MATCH(D$54,INDEX(D$3:D$53,MATCH(2,INDEX(1/(C$3:C$53=C$54),))+SUM(C$57:C57)+ROWS(C$57:C57)):D$53,0)-1
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Simpler formula to handle nested OFFSET function

    Do you want the calculation of occurrences should be below the rows in the same column (C & D). Can it be done some other column say K & L starting from 2nd row.

  12. #12
    Registered User
    Join Date
    05-04-2018
    Location
    Hong Kong
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    69

    Re: Simpler formula to handle nested OFFSET function

    The formula seems to work.
    It is a little difficult for us to apply because it requires us to insert an artifical row (green row 48 in your file) below the lastest row of data.
    In reality, we are working with many formulas, that make reference to the latest row of data, so that would require us to change all those to accomodate an artificial row.
    However, the formula is brilliant and probably better than nested offset function.
    Thank you very much!

  13. #13
    Registered User
    Join Date
    05-04-2018
    Location
    Hong Kong
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    69

    Re: Simpler formula to handle nested OFFSET function

    Quote Originally Posted by kvsrinivasamurthy View Post
    Do you want the calculation of occurrences should be below the rows in the same column (C & D). Can it be done some other column say K & L starting from 2nd row.
    You see, in reality we are working with over 1,700 rows and many columns, so we prefer to have the formula returned values below the relevant columns, in order for the file to be managable..

  14. #14
    Registered User
    Join Date
    05-04-2018
    Location
    Hong Kong
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    69

    Re: Simpler formula to handle nested OFFSET function

    Just dropping a note of thanks.
    The formula seem to work wells.

+ 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. Simpler way than 10+ nested IF statements?
    By jobinv123 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-14-2015, 11:40 PM
  2. Replies: 0
    Last Post: 09-29-2013, 04:50 AM
  3. Replies: 2
    Last Post: 05-22-2013, 05:39 PM
  4. [SOLVED] Nested Function & Offset Cells Help
    By DDM64 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-24-2013, 04:31 PM
  5. A simpler way to do nested vlookups?
    By bsoper in forum Excel General
    Replies: 4
    Last Post: 01-06-2011, 03:43 PM
  6. Looking for a simpler formula instead of using may nested "IF"s
    By Ogbuehi in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-19-2009, 11:15 AM
  7. [SOLVED] Offset function with nested match function not finding host ss.
    By MKunert in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-21-2006, 06:50 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