+ Reply to Thread
Results 1 to 4 of 4

Return the next value in a list after a specific value is found

  1. #1
    Registered User
    Join Date
    08-07-2012
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    15

    Return the next value in a list after a specific value is found

    Hi, I'm probably over complicating this....

    I'm trying to use Index/Match with SUMIFS to add different ranges of sequenced of values. I'm hoping to avoid using an array formula, but not a deal breaker if I need one.

    Is there a formula that will sum down (and stop) at a variety of different values, then stop summing? In my example the sum starts at letter "SG" and then needs to stops at the value that comes next after "SA" which could be either and variation of "T", "h", "S", or "SG". To make things harder, I wanted the sum to also omit any rows with "V" or "X" in an adjacent column.

    Attached is my example sheet.

    So far I've built this formula. But I'm stuck on the "SG" string. I don't know how to find/return the next value after "SA".

    N(" T >> T Stop at T (skip over h, S, SG, SA)")+
    IF(C21="T",ROUND(SUMIFS(L22:INDEX(L22:L$45,IFERROR(MATCH("T",C22:C$45,)-1,)),C22:INDEX(C22:C$45,IFERROR(MATCH("T",C22:C$45,)-1,)),"<>h",C22:INDEX(C22:C$45,IFERROR(MATCH("T",C22:C$45,)-1,)),"<>S",C22:INDEX(C22:C$45,IFERROR(MATCH("T",C22:C$45,)-1,)),"<>SG",C22:INDEX(C22:C$45,IFERROR(MATCH("T",C22:C$45,)-1,)),"<>SA",E22:INDEX(E22:E$45,IFERROR(MATCH("T",C22:C$45,)-1,)),"<>V",E22:INDEX(E22:E$45,IFERROR(MATCH("T",C22:C$45,)-1,)),"<>X"),0),

    N(" h >> h Stop at h (skip over S, SG, SA)")+
    IF(C21="h",ROUND(SUMIFS(L23:INDEX(L23:L$46,IFERROR(MATCH("h",C23:C$45,)-1,)),C23:INDEX(C23:C$45,IFERROR(MATCH("h",C23:C$45,)-1,)),"<>S",C23:INDEX(C23:C$45,IFERROR(MATCH("h",C23:C$45,)-1,)),"<>SG",C23:INDEX(C23:C$45,IFERROR(MATCH("h",C23:C$45,)-1,)),"<>SA",E23:INDEX(E23:E$45,IFERROR(MATCH("h",C23:C$45,)-1,)),"<>V",E23:INDEX(E23:E$45,IFERROR(MATCH("h",C23:C$45,)-1,)),"<>X"),0),

    N(" S or SA >> Stop at any value T, h, S, SG, or SA (+1)")+
    IF(OR(C21="S",C21="SA"),ROUND(SUMIFS(L22:INDEX(L22:L$45,IFERROR(MATCH(D21+1,D22:D$45,)-1,)),C22:INDEX(C22:C$45,IFERROR(MATCH(D21+1,D22:D$45,)-1,)),"<>s",E22:INDEX(E22:E$45,IFERROR(MATCH(D21+1,D22:D$45,)-1,)),"<>V",E22:INDEX(E22:E$45,IFERROR(MATCH(D21+1,D22:D$45,)-1,)),"<>X"),0),

    N(" SG >> Stop at either T, h, S, SG (skip over SA)")+
    ?????

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: Return the next value in a list after a specific value is found

    I can not follow this at all. Where are your manually calculated results? If they are NOT there, please delete non-working formulae, leaving the criteria and the manually calculated results. If they ARE there, where are they?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    08-07-2012
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Return the next value in a list after a specific value is found

    Hi Glenn, I'm sorry for the confusion. My sheet was incorrect. I cleaned it up and hopefully it makes more sense now. Please disregard my first post. My sincere apologies!!

    To recap my intent...
    I'm in need of a formula that can sum values within a defined region (while omitting any rows that have values in column "B" and column "D"). The formula should first find/identify the next value in column "B" where the values indicate the end of the summing region (while also indicating the start of the next summing region). For example letters are used are ("T", "h", "S", "SG", or "SA".)

    My formula posted above is incomplete. I only provided it because I suspect someone may suggest a better approach.

    Currently I am unable to solve summing the "SG" summing region. I'm not sure how to identify which letter comes first after "SA" (which could be a variation of "T", "h", "S", or "SG"). Then based on which letter comes first, the formula would sum up to that letter.

    I plan to use the formula in the yellow cells in column "G" in my sheet.

    I hope this is more clear.

  4. #4
    Registered User
    Join Date
    08-07-2012
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Return the next value in a list after a specific value is found

    I wanted to offer an update. I was able to solve this myself.
    My solution was to use a helper row containing a formula that provides a unique value to indicate the end of my grouping categories. With this I am able to stop my sum. I included my solution (and formulas) in my newly attached sheet.

+ 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] Return MIN from a list After MAX is found - MIN number to the right of MAX
    By RidgeRunner in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-22-2018, 08:45 AM
  2. Return column header when specific value is found in row.
    By houlep in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-07-2017, 11:38 PM
  3. [SOLVED] Return TRUE if cell value is found in a list
    By Smally in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-20-2016, 10:21 AM
  4. VBA Search a set of strings, return specific data if found
    By banaanas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2014, 03:54 AM
  5. [SOLVED] Return Column Number when specific text is found
    By Simon.xlsx in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-29-2014, 12:20 PM
  6. [SOLVED] Look for a list of strings in sentence and if found, return a value
    By chemisiq in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-25-2013, 08:14 AM
  7. [SOLVED] If specific text is found in cell, then return a number
    By csch123 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-31-2013, 05:07 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