+ Reply to Thread
Results 1 to 13 of 13

Vlook Months (dates) to search nearest month in the past and return value

  1. #1
    Forum Contributor
    Join Date
    06-12-2009
    Location
    Banglore
    MS-Off Ver
    Excel 2007
    Posts
    129

    Vlook Months (dates) to search nearest month in the past and return value

    Hi,

    Vlook Months (dates) to search nearest month in the past and return value.

    Please refer the attached file.
    Attached Files Attached Files
    Shan

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Vlook Months (dates) to search nearest month in the past and return value

    'Nearest month in the past' means previous month, right? Or I don't understand something.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Forum Contributor
    Join Date
    06-12-2009
    Location
    Banglore
    MS-Off Ver
    Excel 2007
    Posts
    129

    Re: Vlook Months (dates) to search nearest month in the past and return value

    yes closest Previous month in the list of months available

  4. #4
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Vlook Months (dates) to search nearest month in the past and return value

    Based on your in file description..

    I created

    In E6:
    Please Login or Register  to view this content.
    In D6 I changed formula to
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    (edate in D-columnnot a crititcal change, more a case of my preferrence as it is easier to read / build)



    you may have to play with the "<"&EDATE(D6;1) condition in the formula to get what you want exactly. I was a bit confused by the request in the post and instructions in the file itself.
    I choose to use EDATE but formula EOMONTH might also be an option in this case depending on the date input in the actual sheet.

    see attachement for working solution
    Attached Files Attached Files
    Last edited by Roel Jongman; 02-05-2019 at 06:16 AM.

  5. #5
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Vlook Months (dates) to search nearest month in the past and return value

    So results should be like below:

    Year Month Number Completed Till Date
    2019 Mar-19 28
    2019 Apr-19 69
    2019 May-19 111
    2019 Jun-19 152
    2019 Jul-19 193
    2019 Aug-19 235
    2019 Sep-19 276
    2019 Oct-19 317
    2019 Nov-19 359
    2019 Dec-19 400

    for each month value from table Status for previous month, right?

  6. #6
    Forum Contributor
    Join Date
    06-12-2009
    Location
    Banglore
    MS-Off Ver
    Excel 2007
    Posts
    129

    Re: Vlook Months (dates) to search nearest month in the past and return value

    Hi Roel,

    We are close.

    I don't want a sumif .. if I am searching for May-19 it should show the value in column C of Status Worksheet next to the month earlier than May-19.

    for example when search for May-19 value should return as 111 ( which is the count given for the nearest past month Apr-19)

  7. #7
    Forum Contributor
    Join Date
    06-12-2009
    Location
    Banglore
    MS-Off Ver
    Excel 2007
    Posts
    129

    Re: Vlook Months (dates) to search nearest month in the past and return value

    Quote Originally Posted by KOKOSEK View Post
    So results should be like below:

    Year Month Number Completed Till Date
    2019 Mar-19 28
    2019 Apr-19 69
    2019 May-19 111
    2019 Jun-19 152
    2019 Jul-19 193
    2019 Aug-19 235
    2019 Sep-19 276
    2019 Oct-19 317
    2019 Nov-19 359
    2019 Dec-19 400

    for each month value from table Status for previous month, right?
    Your understanding on my need is correct

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

    Re: Vlook Months (dates) to search nearest month in the past and return value

    Please try at E6 and drag down

    =VLOOKUP(D6-1,Status!$B$2:$C$25,2)

  9. #9
    Forum Contributor
    Join Date
    06-12-2009
    Location
    Banglore
    MS-Off Ver
    Excel 2007
    Posts
    129

    Re: Vlook Months (dates) to search nearest month in the past and return value

    Quote Originally Posted by Bo_Ry View Post
    Please try at E6 and drag down

    =VLOOKUP(D6-1,Status!$B$2:$C$25,2)
    This works as expected till I reach Dec-19, When the same formula goes to Jan-20 it shows blank. it should show 400

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

    Re: Vlook Months (dates) to search nearest month in the past and return value

    Please try again E6

    =LOOKUP(2,1/(D6>Status!$B$2:$B$25)/(Status!$C$2:$C$25<>""),Status!$C$2:$C$25)

  11. #11
    Forum Contributor
    Join Date
    06-12-2009
    Location
    Banglore
    MS-Off Ver
    Excel 2007
    Posts
    129

    Re: Vlook Months (dates) to search nearest month in the past and return value

    Quote Originally Posted by Bo_Ry View Post
    Please try again E6

    =LOOKUP(2,1/(D6>Status!$B$2:$B$25)/(Status!$C$2:$C$25<>""),Status!$C$2:$C$25)
    You Rock Thats all I wanted .. Thank you so much

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

    Re: Vlook Months (dates) to search nearest month in the past and return value

    Happy to help.
    Thank you for the feedback and mark topic Solved

  13. #13
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Vlook Months (dates) to search nearest month in the past and return value

    Or something more clear to understand (E5):

    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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. Count how many dates are this month, 2 months and 3 months old
    By jimmisavage in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-21-2017, 09:21 AM
  2. Replies: 2
    Last Post: 02-26-2017, 10:27 PM
  3. [SOLVED] Highlight the dates from given month and past years
    By pipsmultan in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 11-03-2015, 06:21 AM
  4. [SOLVED] Highlight the current or past month dates | Confuse|
    By pipsmultan in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-30-2015, 04:48 AM
  5. [SOLVED] Make row that automatically adds newest month + 2 nearest future months
    By cudh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-25-2014, 08:40 AM
  6. recognizing dates past End of Month
    By sk81222 in forum Excel General
    Replies: 6
    Last Post: 06-14-2006, 10:43 AM
  7. Graphing past months (totals) and current month (weekly total) in
    By Davin in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-27-2005, 12:05 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