+ Reply to Thread
Results 1 to 7 of 7

how to return first date value in a list that equals the current month

  1. #1
    Registered User
    Join Date
    04-29-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    34

    Question how to return first date value in a list that equals the current month

    Having trouble with 2 formulas...

    Each column has 3 cells (plus header) There are 2 to 3 values that can be returned (In this case, biweekly paychecks where a couple months a year there are 3 pay periods)

    The value = a specific date (pay date) in mm/dd/yyyy format

    The value is found on another sheet based on the current year using (INDIRECT(YEAR(TODAY())

    This can possibly be done 2 ways?

    Option 1 (not sure if it's possible to create the second)
    The first cell in the column should lookup the first value in a list that equals the current month.
    The second cell in the column should lookup the second value in a list that equals the current month.
    The third cell in the column should lookup the third / last value in a list that equals the current month.

    Option 2 (more likely)
    The first cell in the column should lookup the first value in a list that equals the current month.
    Second cell = First cell + 14 days
    Third Cell = If second cell + 14 days = next month, then return "", otherwise third cell = Second cell + 14 days

    To get the first date value from the list, The formula that I was thinking would work is...

    MATCH(TRUE,INDIRECT(YEAR(TODAY())&"!$B$7:$B$32")>MONTH(TODAY()),0)
    or
    MATCH(TRUE,INDIRECT(YEAR(TODAY())&"!$B$7:$B$32")=MONTH(TODAY()),0)

    but nogo. Should i use an Index or lookup function instead?

    To get cell the second and third cells to work. I thought this formula would work, but it does not.

    IF(A3+14<>MONTH(TODAY()),"",A3+14)

    Sample workbook attached.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,791

    Re: how to return first date value in a list that equals the current month

    MATCH just returns the row number, so you need this:

    =INDEX(INDIRECT(YEAR(TODAY())&"!$B$7:$B$32"),MATCH(TRUE,INDIRECT(YEAR(TODAY())&"!$B$7:$B$32")>MONTH(TODAY()),0))

    To get it to increment, add this:

    =INDEX(INDIRECT(YEAR(TODAY())&"!$B$7:$B$32"),MATCH(TRUE,INDIRECT(YEAR(TODAY())&"!$B$7:$B$32")>MONTH(TODAY()),0)+ROW(A1)-1)

    Copy down.
    Attached Files Attached Files
    Last edited by AliGW; 07-11-2020 at 01:32 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,620

    Re: how to return first date value in a list that equals the current month

    Here:
    INDIRECT(YEAR(TODAY())&"!$B$7:$B$32")>MONTH(TODAY())
    days (dates) are compared with months. in all cases any date will be higher than any month number.
    Try for instance:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    or INDEX but using INDIRECT(YEAR(TODAY())&"!$B$7:$B$32")>EOMONTH(TODAY(),-1)+1 in MATCH

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


    EDIT:
    >EOMONTH(TODAY(),-1)
    or
    >=EOMONTH(TODAY(),-1)+1
    shall be used. Otherwise you will not notice first day of given month
    Last edited by Kaper; 07-11-2020 at 02:03 AM. Reason: correction foor the first day of month
    Best Regards,

    Kaper

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,620

    Re: how to return first date value in a list that equals the current month

    Yet another option with VLOOKUP in one column (note not exact match - 4th parameter equal TRUE or omitted, and +14 to look for latest date not later than 14th day of month)
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And corrected version with INDEX:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note usage of EOMONTH(TODAY(),-1) (not+1 as we compare as "greater than", not "greater or equal to")

    In 3 tables in attachment all 3 solutions are presented
    Attached Files Attached Files
    Last edited by Kaper; 07-11-2020 at 02:05 AM.

  5. #5
    Registered User
    Join Date
    04-29-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    34

    Re: how to return first date value in a list that equals the current month

    Thank you both!

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,791

    Re: how to return first date value in a list that equals the current month

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,620

    Re: how to return first date value in a list that equals the current month

    Thanks for marking thread SOLVED and for reputation point.

    Which solution have you finally adopted?

+ 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. how do you return a range of selected rows that equals the span of the current region?
    By foxtrotter in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-31-2019, 12:35 PM
  2. Filling down a table to current month/date with VBA up to current month
    By atombomb99 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-12-2019, 03:34 PM
  3. Return a price if month equals this?
    By faustjann in forum Excel General
    Replies: 14
    Last Post: 12-18-2015, 09:24 AM
  4. [SOLVED] Find each date in the current month and return the corresponding data
    By flarunner in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-25-2015, 12:31 PM
  5. Return True or False if date range falls within current month
    By kieran614 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-17-2013, 12:02 PM
  6. [SOLVED] Date Formula to Return Week Number in Current Month based on Reporting Period
    By jeversf in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-25-2013, 12:10 PM
  7. Replies: 1
    Last Post: 08-13-2012, 11:18 AM

Tags for this Thread

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