+ Reply to Thread
Results 1 to 3 of 3

Find the earliest date within comma-separated values

  1. #1
    Forum Contributor
    Join Date
    10-06-2012
    Location
    Basel, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    157

    Find the earliest date within comma-separated values

    Good day everybody,
    I need a formula or a macro to find the earliest date in comma-separated values in the same cell:

    Before
    A1: 20100506, 20081126, 20100525
    A2: 20090408, 20100915, 20100920, 20101006, 20090323, 20110819, 20130930

    After
    A1: 20081126
    A2: 20090323

    Thank you so much

    Nick

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Find the earliest date within comma-separated values

    if they are like you have shown with , space seperating them try this array entered formula
    =MIN(--MID(A1,ROW(INDIRECT("1:"&LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1))*10-9,8))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Find the earliest date within comma-separated values

    you pm'd me to ask "why did you multiply the values with 10, then subtracted it by 9.
    ok
    ROW(INDIRECT("1:"&LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1))*10-9
    LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1 will give the number of strings in the list
    so with 3 dates
    it resolves to
    ROW(INDIRECT("1:"&3))*10-9
    which becomes
    row(1:3)*10-9
    row(1:3) is the same as this array {1;2;3}
    your text stings start in positions 1,11,21 and are 8 characters long
    mid(a1,{1;2;3},8) would be wrong
    so
    multiplying the {1;2;3} by 10 gives
    {10;20;30}
    this is getting there but is 9 to great for each term so subtract 9
    {10;20;30}-9
    becomes {1;11;21}
    so now you have
    mid(a1,{1;11;21},8)

+ 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: 1
    Last Post: 05-29-2014, 12:27 PM
  2. [SOLVED] Macro to give the count of unique values after comparing the comma separated values
    By Manish_Gupta in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2014, 12:41 AM
  3. count of comma separated values
    By bujji1305 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-01-2012, 07:33 PM
  4. Comma separated values
    By shrikantk in forum Excel General
    Replies: 3
    Last Post: 05-18-2009, 09:52 AM

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