+ Reply to Thread
Results 1 to 14 of 14

extracting values from string

  1. #1
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2010
    Posts
    291

    extracting values from string

    Hi all!

    I have a row with a strings. The typical string is
    "The Bonds shall be payable in three equal annual instalments on 30th November 2010, 2011 and 2012, and bear a semi annual coupon. Offert date:14.11.2008 Price:86.33613167, Offert date:18.11.2008 Price:83.54645761, Offert date:05.12.2008 Price:79.76367227,"

    In some cell there is a date. The question is how to extract the earliest offert date from the above string which is greater than the date in some some cell.

    I'm looking for the single formula. Anybody that can help, thanks a lot in advance!!!

  2. #2
    Forum Expert RobertMika's Avatar
    Join Date
    06-22-2009
    Location
    Haverhill, UK
    MS-Off Ver
    Excel 2003-13
    Posts
    1,530

    Re: extracting values from string

    Quote Originally Posted by Alexander_Golinsky View Post
    Hi all!

    I have a row with a strings. The typical string is
    "The Bonds shall be payable in three equal annual instalments on 30th November 2010, 2011 and 2012, and bear a semi annual coupon. Offert date:14.11.2008 Price:86.33613167, Offert date:18.11.2008 Price:83.54645761, Offert date:05.12.2008 Price:79.76367227,"

    In some cell there is a date. The question is how to extract the earliest offert date from the above string which is greater than the date in some some cell.

    I'm looking for the single formula. Anybody that can help, thanks a lot in advance!!!
    what do youmean by:
    "which is greater than the date in some some cell"?

  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: extracting values from string

    i dont think you will as match will not accept the calculations neccesary to extract the dates
    best i can do is
    with that info in a1 in b1:c1
    =DATEVALUE(SUBSTITUTE(MID(SUBSTITUTE($A$1,"date:","^",3),FIND("^",SUBSTITUTE($A$1,"date:","^",3))+1,10),".","/"))
    =DATEVALUE(SUBSTITUTE(MID(SUBSTITUTE($A$1,"date:","^",2),FIND("^",SUBSTITUTE($A$1,"date:","^",2))+1,10),".","/"))
    =DATEVALUE(SUBSTITUTE(MID(SUBSTITUTE($A$1,"date:","^",1),FIND("^",SUBSTITUTE($A$1,"date:","^",1))+1,10),".","/"))
    then in say h1
    =INDEX(B1:D1,MATCH(E1+1,B1:D1,-1))
    put your date to look for in e1
    Attached Files Attached Files
    Last edited by martindwilson; 06-19-2012 at 04:45 AM.
    "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

  4. #4
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: extracting values from string

    Martin, Thank you a lot! You're true guru. I'm pretty sure that there is no better solution. Thank you again!

  5. #5
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: extracting values from string

    But on my comp, in ur file datevalue doesn't work and gives me #value! error

  6. #6
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: extracting values from string

    sure it's possible to do the same with date function, but why it works for you and doesn't for me?

  7. #7
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: extracting values from string

    i got it. your comp uses European date format and mine - American, so mine thinks that 18 is month and displays the error. I'll go fro date function

  8. #8
    Registered User
    Join Date
    06-06-2012
    Location
    Switzerland
    MS-Off Ver
    MS Excel 365
    Posts
    68

    Re: extracting values from string

    Alternative solution... single formula as requested... as attached :-)

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

    Re: extracting values from string

    @fixandfoxi 17-Dec-08 gives value error

  10. #10
    Registered User
    Join Date
    06-06-2012
    Location
    Switzerland
    MS-Off Ver
    MS Excel 365
    Posts
    68

    Re: extracting values from string

    Not sure what you mean. See attached screenshot, my 17-Dec-2008 is working...?
    Attached Images Attached Images

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

    Re: extracting values from string

    hmm but the answer should be 18th surely
    besides which you don't know how long the price string will be that could affect the position of the date.
    Last edited by martindwilson; 06-19-2012 at 08:51 AM.

  12. #12
    Registered User
    Join Date
    06-06-2012
    Location
    Switzerland
    MS-Off Ver
    MS Excel 365
    Posts
    68

    Re: extracting values from string

    I don't think so. When the "Reference Date" is 19.11.2008, then the result should be 05.12.2008. Because this is the date "which is greater than the date in some some cell". So the 18.11.2008 would be smaller. Hmm, this is my understanding from the original request above.

    You can amend the string by its length and this does not change the result. I searched for the term "Offert date:" and captured then the following, relevant characters for the date. Just try!!! If I would go for the position of the date only, yes, then I would have this problem...
    Last edited by FixandFoxi; 06-19-2012 at 09:42 AM.

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

    Re: extracting values from string

    nope see attached i changed the prices
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    06-06-2012
    Location
    Switzerland
    MS-Off Ver
    MS Excel 365
    Posts
    68

    Re: extracting values from string

    Good to see that you have no longer this error value! I have updated the formula in order to absorb unexpected, multiple changes in the text/prices... as attached... Thanks!

+ 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