+ Reply to Thread
Results 1 to 7 of 7

Row # of first "day" of current month.

  1. #1
    John Eppley
    Guest

    Row # of first "day" of current month.

    Hi: I have several workbooks which contain data sequentially entered by
    "date". It is necessary to determine the FIRST data entry for a given month.
    For example, I may have a data entry for the first of the month "mm-01-yy".
    My equations work well for this condition, but if there is NO data entry for
    the first of the month I do not know how to accurately find the row number
    of the first month's entry.

    John






  2. #2
    Niek Otten
    Guest

    Re: Row # of first "day" of current month.

    Hi John,

    With dates in A and search date in B1:

    =IF(MONTH(INDEX(A1:A39,MATCH(B1,A1:A39)))=MONTH(B1),MATCH(B1,A1:A39),MATCH(B1,A1:A39)+1)

    Of course the formula can be much shorter if you use an extra cell for the

    MATCH(B1,A1:A39)

    part

    --
    Kind regards,

    Niek Otten

    "John Eppley" <[email protected]> wrote in message news:[email protected]...
    > Hi: I have several workbooks which contain data sequentially entered by "date". It is necessary to determine the FIRST data
    > entry for a given month. For example, I may have a data entry for the first of the month "mm-01-yy". My equations work well for
    > this condition, but if there is NO data entry for the first of the month I do not know how to accurately find the row number of
    > the first month's entry.
    >
    > John
    >
    >
    >
    >
    >




  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,786
    Perhaps

    =MATCH(TRUE,INDEX(MONTH(A1:A39)=MONTH(B1),0),0)

    although you might want to do this differently depending on your ultimate aim

  4. #4
    Jim May
    Guest

    Re: Row # of first "day" of current month.

    In cell B2 enter:
    =IF(MONTH(A2)=MONTH(A1),"",ROW(A2))

    And Copy Down



    "John Eppley" <[email protected]> wrote in message
    news:[email protected]...
    > Hi: I have several workbooks which contain data sequentially entered by
    > "date". It is necessary to determine the FIRST data entry for a given
    > month. For example, I may have a data entry for the first of the month
    > "mm-01-yy". My equations work well for this condition, but if there is NO
    > data entry for the first of the month I do not know how to accurately find
    > the row number of the first month's entry.
    >
    > John
    >
    >
    >
    >
    >




  5. #5
    John Eppley
    Guest

    Re: Row # of first "day" of current month.

    Your formula appears to give the row# of the last day of the current month.
    I am looking for the row number of the FIRST entry for the current month. I
    can easily find the last row# by using COUNT(A:A).

    I have been using
    "=MATCH(DATEVALUE(MONTH(TODAY())&"-1-"&YEAR(TODAY())),A:A,0)"

    This formula fails if there is NO entry for the first day of the month.

    Thank you.
    John



    "Niek Otten" <[email protected]> wrote in message
    news:u%[email protected]...
    > Hi John,
    >
    > With dates in A and search date in B1:
    >
    > =IF(MONTH(INDEX(A1:A39,MATCH(B1,A1:A39)))=MONTH(B1),MATCH(B1,A1:A39),MATCH(B1,A1:A39)+1)
    >
    > Of course the formula can be much shorter if you use an extra cell for the
    >
    > MATCH(B1,A1:A39)
    >
    > part
    >
    > --
    > Kind regards,
    >
    > Niek Otten
    >
    > "John Eppley" <[email protected]> wrote in message
    > news:[email protected]...
    >> Hi: I have several workbooks which contain data sequentially entered by
    >> "date". It is necessary to determine the FIRST data entry for a given
    >> month. For example, I may have a data entry for the first of the month
    >> "mm-01-yy". My equations work well for this condition, but if there is NO
    >> data entry for the first of the month I do not know how to accurately
    >> find the row number of the first month's entry.
    >>
    >> John
    >>
    >>
    >>
    >>
    >>

    >
    >




  6. #6
    John Eppley
    Guest

    Re: Row # of first "day" of current month.

    Niek: My apologies.....when cell B1 contains "NOW()" the result is the last
    row#. When I replace cell B1 with "6/01/06" your formula behaves perfectly.
    Thanks for your help.

    John
    "



  7. #7
    John Eppley
    Guest

    Re: Row # of first "day" of current month.

    More problems. Note that the MATCH function has a default of "1" for the
    "matchtype". The data can have three possibilities regarding the first day
    of the month. There can be one entry, there can be NO entries, or there can
    be more than one entry.

    The formula fails if the matchtype is a "1" and there is more than one entry
    for that date. It will also fail for a matchtype of "0" and there is NO
    entry for the first day of the month. For the last year I have been using a
    "placeholder" of a ficticious entry for the first-of-the-month. That way, a
    matchtype of "1" will always work.

    John Eppley



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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