+ Reply to Thread
Results 1 to 10 of 10

Finding dates within a column

  1. #1
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Finding dates within a column

    Hi I have column "B" containing various dates i.e 04/09/2018 or the word blank. What I'd like to do is have a formula/vba that finds the first date in column B and displays it in Cell AO1 and the last date found in Column B in cell AO2.

    Many thanks in advance

    Dave

  2. #2
    Forum Contributor
    Join Date
    05-16-2018
    Location
    Pittsburgh, PA
    MS-Off Ver
    2016
    Posts
    109

    Re: Finding dates within a column

    Please attach a sample workbook for better help

    Go Advanced (bottom of thread)
    Additional Options Box (bottom of post reply box)
    Attachments, click manage attachments
    Upload from computer or wherever, click Upload
    Close window,
    Then Submit Reply

    From the description given, the use of the OFFSET function may be what you need

  3. #3
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Finding dates within a column

    Sure I've attached an example. so the first date would be 03/09/2018 and the last would be 12/03/2018


    Thank you in advance.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    05-16-2018
    Location
    Pittsburgh, PA
    MS-Off Ver
    2016
    Posts
    109

    Re: Finding dates within a column

    Would all of column B have dates filled out all the way down?

    Are the blanks actual dates? or just empty cells?

  5. #5
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Finding dates within a column

    Hi sorry not sure what you mean by the first question, column B would have dates or the word “blank” down to about B30000. The blanks are just the word blank exactly as in the attachment.

    Cheers

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,706

    Re: Finding dates within a column

    Here is a VBA solution for you.
    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  7. #7
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Finding dates within a column

    Great exactly what I needed.

    Many thanks

    Cheers

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,412

    Re: Finding dates within a column

    You can use this array* formula in cell AO3:

    =INDEX(B1:B220,MIN(IF(ISNUMBER(B1:B220),ROW(B1:B220))))

    *Note an array formula needs to be committed using the key combination Ctrl-Shift-Enter (CSE) instead of the usual < Enter >.

    You can have this non-array formula in AO4:

    =LOOKUP(9E9,B:B)

    Format both cells as a date in the style you prefer.

    Hope this helps.

    Pete

  9. #9
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Finding dates within a column

    Quote Originally Posted by Pete_UK View Post
    You can use this array* formula in cell AO3:

    =INDEX(B1:B220,MIN(IF(ISNUMBER(B1:B220),ROW(B1:B220))))

    *Note an array formula needs to be committed using the key combination Ctrl-Shift-Enter (CSE) instead of the usual < Enter >.

    You can have this non-array formula in AO4:

    =LOOKUP(9E9,B:B)

    Format both cells as a date in the style you prefer.

    Hope this helps.

    Pete
    Thank you, I hadn't decided if I was going to use a macro doc or not so very useful to have both options.

    Cheers

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,412

    Re: Finding dates within a column

    You're welcome - thanks for the rep.

    Pete

+ 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. Finding smallest value greater than x in a column while also matching dates.
    By pcopeland in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-04-2018, 04:06 PM
  2. [SOLVED] Finding dates in a column
    By Saturn in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-06-2015, 02:16 PM
  3. [SOLVED] Finding the latest and oldest dates in a filtered column.
    By skyping in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-04-2015, 05:35 PM
  4. Finding Missing Dates In a Column of Dates
    By ExcelStudent123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2014, 05:37 PM
  5. Finding a date in a specific column surounded by other columns with similar dates
    By Freakazoid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-21-2012, 05:28 AM
  6. Replies: 4
    Last Post: 12-19-2011, 08:40 AM
  7. Finding all dates in a column that are in the range today to a week from now
    By jrcream in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-01-2008, 09:32 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