+ Reply to Thread
Results 1 to 18 of 18

Nested if mid and find, possible?

  1. #1
    Registered User
    Join Date
    05-09-2019
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    25

    Nested if mid and find, possible?

    Hi i'm tearing my hair out as i'm sure many of us visiting looking for excel answers are! you help is much appreciated

    I have data which is non structured that i am trying to pull a date from in the format of 09/Sep/2018
    i have thousands of rows but the date always appears after 10 different specific words, maybe there is a better way but i have been able to pull the date using the words and the mid functions as the examples below

    at the moment it successfully does it but i have to do each word in a different column.

    i would like to be able to nest the formulas somehow so i can have the results all in one column but i cant work out how? is this possible or is there a better way?

    Thanks in advance


    =MID($A2,FIND("dizzying ",$A2)+9,11)

    =MID($A62,FIND("COMPLETE ",$A2)+9,11)

    =MID($A287,FIND("jukebox ",$A2)+8,11)

    =MID($A290,FIND("Yes ",$A2)+4,11)

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Nested if mid and find, possible?

    What if you go from the other direction and use >> =RIGHT(A2,11)

    =IF(SUMPRODUCT(--ISNUMBER(SEARCH({"dizzying","COMPLETE","jukebox","Yes"},A2))),RIGHT(A2,11),"No")

    If this does not help then a sample file would help.
    Last edited by jeffreybrown; 05-23-2019 at 08:07 PM.
    HTH
    Regards, Jeff

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Nested if mid and find, possible?

    If as you say there are ALWAYS 10 words before the date and assuming there's always a space between the words then I;d be inclined to use a
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This will create a pipe symbol at the 10th space. You can then wrap SUBSTUTUTE in a
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    which returne the position of the pipe symbol immediately prior to the data, and then a simple MID() function using this position will allow you to grab the date
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    05-09-2019
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    25

    Re: Nested if mid and find, possible?

    Thanks guys, i think i may have been bad with the description

    ill upload screenshots for now as im not sure how to attach but this is what i want it to look like and the style - its not uniformed so the date is in the same place each time, the date is in a random place.

    by 10 words i meant that it does not come after 10 words in a string but there are 10 specific words such as jukebox, complete, dizzying or yes where the date i want always follows. so my current formula looks for that word in the text then returns the date asit comes after and i tell excel to return that number of characters.


    i want it to look like
    comment date
    dave danced in the jukebox 20/jan/2019 20-Jan-19
    paul fell dizzying 19/sep/2019 19-Sep-19
    graham ate a bannana while crouching on a jukebox 05/Nov/2018 it made him ill 05-Nov-18
    1 day the mand from del monte said yes 08/Aug/2019 mike laughed 08-Aug-19
    paul said 2 helicopters are scary when the rotors are both complete 12/Dec/2017 im not sure why 12-Dec-17
    Helen drank the jukebox 25/Nov/2018 25-Nov-18
    Helen said yes 07/Feb/2017 crazy cheese hat 07-Feb-17
    the face was complete 23/Mar/2017 Helen was not 23-Mar-17
    the Onions hand was dizzying 09/Sep/2018 it cried 09-Sep-18

    Attachment 625708

    It currently looks like


    Attachment 625711

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Nested if mid and find, possible?

    Please don't upload pictures, they're rarely much help.

    You've got a workbook so upload that and be sure to include some manually calculated results so that we know the end goal

  6. #6
    Registered User
    Join Date
    05-09-2019
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    25

    Re: Nested if mid and find, possible?

    apologies ive been trying to figure out how to upload but the attachment option only gives a blank bar with no options so im not sure how to do it?

    thank you for your help
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-09-2019
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    25

    Re: Nested if mid and find, possible?

    it seems to have worked!

    tab1 shows how I want it to look with the calculation in one column

    tab2 shows the formula working but in separate columns for the keywords I would like to find a way of nesting the formula so I don't need to spread it across the columns

    Thank you

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Nested if mid and find, possible?

    It appears every date is formatted the same way in your sample, so try in B2 copied down >> =MID(A2,FIND("/",A2)-2,11)+0

    Now format the cell as a date

  9. #9
    Registered User
    Join Date
    05-09-2019
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    25

    Re: Nested if mid and find, possible?

    Wow Thank you Jeffrey! such a simple fix without nesting, I really appreciate that

    that worked, I have 2 further questions (last ones!) -

    if I were to have 2 dates in the description box would there be a way to pull out only the last date shown within the description - this is in the attachment on tab scenario 1



    now the tough one - again similar - shown as scenario 2 tab in the attached

    I want to find out a 4 digit number beginning with 1 and display the number as the answer in the new cell from a description box with text which is non uniformed and can also contain numbers. it is always preceeded by a / or - or a space. I have thought about vlookup as there is a number range between 1000 and 1999 that the number would fall in but im not sure if that would be usable with find?
    Attached Files Attached Files

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Nested if mid and find, possible?

    This is proving to be a little trickery, especially because now your date are not consistent. Some end in 2018 and then some end in 18 or was that a typo?

    If it's a typo, this might be a possibility. =MID(A2,FIND("|",SUBSTITUTE(A2,"/","|",LEN(A2)-LEN(SUBSTITUTE(A2,"/",""))-1))-2,11)+0

    As for scenario 2, I'll have to reach out to the true formula experts.

  11. #11
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Nested if mid and find, possible?

    Try this in B2 (Scenario 1):

    Please Login or Register  to view this content.

  12. #12
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Nested if mid and find, possible?

    For scenario 1, try

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I think that this is right for scenario 2

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by jason.b75; 05-24-2019 at 01:53 PM.

  13. #13
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Nested if mid and find, possible?

    Scenario 2:
    Might work if the 4 digit numbers in question always start with "1" as in the upload.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 05-24-2019 at 12:49 PM.
    Dave

  14. #14
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Nested if mid and find, possible?

    Another for Scenario 1
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Then format m/d/yyyy.

  15. #15
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Nested if mid and find, possible?

    Quote Originally Posted by FlameRetired View Post
    Scenario 2:
    Might work if the 4 digit numbers in question always start with "1" as in the upload.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This is awesome. The only possible hole that I see would be if there was something like this:
    Rob1-SZ-123456/12021/1111/10000001/Kent

    But that has not come up in the OP's sample.

  16. #16
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Nested if mid and find, possible?

    Quote Originally Posted by FlameRetired View Post
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I tried something similar, Dave, but couldn't get it to work reliably with different combinations.

    Yours appears to trip over if there is a number of more than 4 digits starting with 1 before the 4 digit number when both numbers are prefixed with the same character, or when the 4 digit number is prefixed with - and the preceding number with more digits is prefixed with /.

    Doing away with the array from my previous effort, I think that this works with all possible combinations.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by jason.b75; 05-24-2019 at 01:28 PM.

  17. #17
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Nested if mid and find, possible?

    @ 63falcondude and jason.b75

    Both good points. Hopefully OP will let us know if either case is in their data.

    jason I tried your formula with what you describe and it seems to hold up.

    So thanks to both of you.

  18. #18
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Nested if mid and find, possible?

    Thanks for he feedback and rep, Dave!

    The fail points that I can see with the formula are those where non-numeric characters fall into the qualifying sub-string, for example.

    Rob-1-SZ-123456/12021/1111/10000001/Kent

    The array in post #12 catches such things, just not very efficiently.
    Last edited by jason.b75; 05-24-2019 at 01:55 PM.

+ 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. [SOLVED] Nested find statement?
    By cchap in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-26-2016, 02:46 AM
  2. Find and Replace with nested If?
    By kvarner in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-15-2015, 05:09 PM
  3. Problem with vba copy find nested loop
    By Anna_P in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-20-2014, 09:08 AM
  4. Nested Do Loops using .Find and .FindNext - Issue
    By James_W in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-14-2012, 09:08 AM
  5. Nested SEARCH or FIND formula query
    By SAsplin in forum Excel General
    Replies: 7
    Last Post: 07-15-2011, 06:00 AM
  6. Nested Formula to find intersection in table
    By RTE in forum Excel General
    Replies: 1
    Last Post: 06-09-2011, 10:01 AM
  7. Using Find or Search in Nested IF statement - more efficiant way?
    By Bytor47 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-11-2009, 10:43 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