+ Reply to Thread
Results 1 to 6 of 6

Find Last Occurrence of Current Cell's Offset Row Value

  1. #1
    Registered User
    Join Date
    04-30-2008
    Posts
    67

    Question Find Last Occurrence of Current Cell's Offset Row Value

    Title sounds a bit weird, but it's really pretty simple (yet I'm posting a question about it, so apparently it's not that simple to me).

    I'm looking for a formula that will get the value of a cell in the current row (say, C16) and find the last occurrence of that value in that column (C), only above the current row. Extra points for returning the value in column G of the last occurrence row.

    I'm basically trying to find the last time a name (C16) occurred in a list (Column C) and see what weekday it was (column G).

    I appreciate the help :beer:

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Find Last Occurrence of Current Cell's Offset Row Value

    Sounds a bit complicated. Can you post some sample data and the results you want to see...based on that sample data?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    04-30-2008
    Posts
    67

    Re: Find Last Occurrence of Current Cell's Offset Row Value

    Quote Originally Posted by Ron Coderre View Post
    Sounds a bit complicated. Can you post some sample data and the results you want to see...based on that sample data?
    Sure!

    I posted the file here, as well as attached a screenshot of what I'm working with. You'll see each person works the same day (Saturday or Sunday), but should alternate weekend days (one Saturday, then one Sunday, one Saturday, one Sunday, etc). I'm trying to see the last day that an person worked - if it was a Saturday, then I know they need to work on a Sunday this week.

    In the example, to see which day Engineer 1 should work, my formula needs to look at the date (actually taken from the date in column G, not the highlighted day of column F) and see which number engineer is in column C of the same row, then search UP to find the last time they worked and which day it was. Then I can change the day appropriately.

    I hope this makes sense...

    Thanks for any help



    Excel Example.jpg

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Find Last Occurrence of Current Cell's Offset Row Value

    There may be 2 kind of sort:

    1) Keep the Eng number sorted, then change the day, like this:
    HTML Code: 
    2) Keep the days sorted, then change the Eng number, like this:
    HTML Code: 
    As you said, maybe you refer to option 1, right?
    Anyway, as per your solution
    my formula needs to look at the date (actually taken from the date in column G, not the highlighted day of column F) and see which number engineer is in column C of the same row, then search UP to find the last time they worked and which day it was. Then I can change the day appropriately.
    that look at day, then come back to change day, it is impossible.

    I refer to option 2.
    Is it accepted?
    Last edited by bebo021999; 03-26-2014 at 12:53 PM.
    Quang PT

  5. #5
    Registered User
    Join Date
    04-30-2008
    Posts
    67

    Re: Find Last Occurrence of Current Cell's Offset Row Value

    Quote Originally Posted by bebo021999 View Post
    There may be 2 kind of sort:

    1) Keep the Eng number sorted, then change the day, like this:
    Yes, this way.


    Quote Originally Posted by bebo021999 View Post
    that look at day, then come back to change day, it is impossible.
    I don't need to look at the day of the current row, I need to find the day of the last time the engineer worked.

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Find Last Occurrence of Current Cell's Offset Row Value

    I see. Follow below steps:
    * G2: date input manually
    * G3: =G2+IF(WEEKDAY(G2)=7,1,6)
    Drag down to last person of first set of dates (G7)
    * G8:
    =LOOKUP(2,1/($E$2:E7=E8),$G$2:G7)+7*(MAX($C$2:$C$43)/2)+IF(WEEKDAY(LOOKUP(2,1/($E$2:E7=E8),$G$2:G7))=1,-1,1)
    Drag down.

+ 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. Copy cell in current row and paste offset down 1
    By mikeop99 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-23-2013, 10:27 PM
  2. Find occurrence of one word more than once in a cell
    By amandeepsharma89 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 02-12-2013, 12:48 AM
  3. Replies: 2
    Last Post: 03-31-2012, 01:08 AM
  4. Enter static date into offset(0,1) if entry into current cell
    By timtim89 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-08-2012, 05:41 PM
  5. Replies: 3
    Last Post: 03-24-2011, 02:00 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