+ Reply to Thread
Results 1 to 5 of 5

Max date per month

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Max date per month

    I get multiple invoices, each containing a column of service dates. These can come in with some weirdly formatted dates, which I have to convert to a TxServDt column. My formula of choice (works best on most invoices) is this:
    Please Login or Register  to view this content.
    Now there's a new wrinkle: instead of the equivalent date of what the vendor supplies, I instead need the last date in the month (not "last day of the month", but "last date in the column for the month in question", so max date per month). See the example attached. Column A is what the vendor provided, column B is what my formula supplies, column C is the result I need. Note that we have May, June and July dates, so what I need is (in this example), 5/30, 6/30, and 7/28.

    How, for my TxServDt column, can I both convert the date AND make sure it's the max date for that month?

    Also, related, my formulas are delivered through a macro. Each vendor puts their date column in a different area, and calls it something different, and formats it differently. So a formula is best because if my macro chooses the wrong column (there are actually multiple different date columns, so it's a guessing game for my macro) I can re-aim the formula to the right column.

    Any help is appreciated.
    Attached Files Attached Files
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

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

    Re: Max date per month

    Please try at B3

    =MAX(--SUBSTITUTE(FILTER($A$3:$A$5584,LEFT($A$3:$A$5584,2)=LEFT(A3,2)),"'",))

    or a lot faster with helper column

    D3
    =--(SUBSTITUTE(A3,"'",))

    E3
    =MAXIFS($D$3:$D$5584,$D$3:$D$5584,"<"&EOMONTH(D3,0)+1)
    =MAX(--SUBSTITUTE(FILTER($A$3:$A$5584,LEFT($A$3:$A$5584,2)=LEFT(A3,2)),"'",))
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2016 & H&B2021
    Posts
    3,065

    Re: Max date per month

    For TxServDt column, formula=DATE(MID(A3,7,2)+2000,LEFT(A3,2),MID(A3,4,2))
    For max date for that month, formula=AGGREGATE(14,6,$B$3:$B$5584/(($B$3:$B$5584>EOMONTH(B3,-1))*($B$3:$B$5584<=EOMONTH(B3,0))),1)

  4. #4
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Max date per month

    I apologize for taking so long to respond. Bo_Ry and Josephteh, both of your formulas worked on my sample data, but as I said the different invoices come in with weirdly formatted dates. See the new workbook attached. Lines 3 to 10 have the dates supplied with my newest invoice. So my formula would have to work with these, too, which yours don't seem to.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Max date per month

    Okay, I've got something that will work. Basically, I'm using two columns "Orig TxSvcDate" and TxSvcDate". The first has my original formula, the second has a Max(Index formula that looks at the previous column.

    Bo_Ry, I would have used your MAXIFS formula instead, but one of my coworkers STILL hasn't updated their version of Excel, so MAXIFS won't work.

    See updated workbook.
    Attached Files Attached Files

+ 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: 3
    Last Post: 06-26-2019, 11:46 AM
  2. Sort month/date/year data using month and date only
    By SMW820 in forum Excel General
    Replies: 8
    Last Post: 11-18-2014, 08:39 AM
  3. How can i show date in this form (month,last date of that month, Year)?
    By vjharry in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-24-2014, 04:39 AM
  4. [SOLVED] Date function- 1st day of month for 2nd full month from start date
    By vidiotdave in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-25-2014, 05:33 AM
  5. Array function for date(month), Range Date(month)
    By dluhut in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-19-2013, 05:14 PM
  6. [SOLVED] Date arithmetic: adding 1 month to prior end of month date
    By manxman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-14-2006, 04:35 PM
  7. Determine begin month date from month end date.
    By mikeburg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-13-2006, 04:42 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