+ Reply to Thread
Results 1 to 4 of 4

Looking for a value from Bottom to top and skipping possible values

  1. #1
    Registered User
    Join Date
    01-30-2015
    Location
    California, USA
    MS-Off Ver
    2003, 2007, 2010 & 2013
    Posts
    20

    Looking for a value from Bottom to top and skipping possible values

    Hello,

    This is a little tricky to explain, so i'll do my best. What i'm looking to do, is I have 2 rows of data, I need to return the 'previous' value entered for that item, however if the previous place is say "Home", i want it to skip "Home" and pull the value above it for that specific item.

    I attached a vague sample sheet for a reference.

    These two columns will be entered by the user:
    Column E is a list of fruits
    Column G is a list of places

    This column I would like to populate with a formula if possible:
    Column I - needs to reference the fruit in Column E and return the last value in column G for that fruit, but if that value is "Home", then it needs to pull the next value above for that fruit (and if that is home, it needs to again keep going up until Home is not the answer). The only time Home will be input in I is if the place entered at that time in G is "Home" (so probably made no sense there). - basically if E5 is Apple and the last instance of Apple is E3 and G3 = Ralphs and G5 = Home, then I5 should be Home, but if APple comes up again say E6 and G6 was Walmart, then I want I6 to be Ralphs.

    I attached a very vague sample data book, the actual book is going to have thousands of entries over the course of several years and is going to continue going for several more years.

    Any help would be greatly appreciated, I do understand i could do this manually, and i've been using a formula that does everything except the skip 'home' part
    =IF(E6100="","",IF(COUNTIF($E$306:E6100,E6100)=1,"All Others",LOOKUP(2,1/($E$270:E6099=E6100),$G$270:G6099)))
    All this basically does is: if the cell in col. E is blank then leave it blank (this is used for future entries), if the count of Column E where E = Apple is 1, then input "All Others" (my generic entry to indicate the first of it's kind), otherwise look bottom to top "Apple" in E, return the Place in G


    Any help would be greatly appreciated.

    Sample Data:
    sample.xlsx
    Last edited by mkn95u0; 05-11-2015 at 08:26 PM.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Looking for a value from Bottom to top and skipping possible values

    I didn't download your file.

    It sounds like you need to add a test to the LOOKUP function:

    =IF(E6100="","",IF(COUNTIF($E$306:E6100,E6100)=1,"All Others",LOOKUP(2,1/(($E$270:E6099=E6100)*($G$270:G6099<>"Home")),$G$270:G6099)))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    01-30-2015
    Location
    California, USA
    MS-Off Ver
    2003, 2007, 2010 & 2013
    Posts
    20

    Re: Looking for a value from Bottom to top and skipping possible values

    Thanks! i actually didn't know i could do that, learned something new.

    This worked!

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Looking for a value from Bottom to top and skipping possible values

    You're welcome. Thanks for the feedback!

+ 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. Replies: 1
    Last Post: 05-21-2014, 04:30 PM
  2. [SOLVED] Delete Unique Values Macro Skipping Some Values
    By stockgoblin42 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-26-2013, 06:27 AM
  3. Query is skipping values
    By 2709236 in forum Access Tables & Databases
    Replies: 2
    Last Post: 11-22-2011, 05:02 PM
  4. Skipping zero values redux!
    By phatkrome in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-06-2009, 10:01 AM
  5. Skipping Zero values for plots
    By Hari in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 05-25-2006, 08:10 AM

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