+ Reply to Thread
Results 1 to 11 of 11

Extracting data from cells based on criteria in other cells

  1. #1
    Registered User
    Join Date
    06-23-2015
    Location
    Ecuador
    MS-Off Ver
    2011
    Posts
    10

    Extracting data from cells based on criteria in other cells

    Hello all!

    I have this formula that I'm sure can be written in a much simpler way.

    To explain how the sheet is set up:
    In Column A, there is the full name of there person
    In Column B, there is the preferred name of the person (can include other information in parenthesis)
    In Column C, the formula

    How the formula should work:
    The formula should include only their preferred name (everything before the "(") or if Column B is blank, just return their first name from Column A (everything before the first space)

    The formula I have works completely. I just seems abnormally long to do something this simple. My formula is (on row 46):
    Please Login or Register  to view this content.
    I've also attached the excel sheet I used to build this formula. I have several tests set up just to make sure all the logic functions like I want it to.
    Attached Files Attached Files
    Last edited by PaulMcCudden; 07-21-2015 at 01:31 PM. Reason: Request from Moderator

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Long Formula

    My contribution

    For Row 43

    =TRIM(IF(OR(ISBLANK(B43), LEFT(TRIM(B43),1)="("), MID(A43, 1, SEARCH(" ",A43)-1), MID(B43, 1, SEARCH("(", B43&"(")-1)))
    Last edited by ChemistB; 07-21-2015 at 01:53 PM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Long Formula

    Try this in D43 copied down--
    =IF(AND(SUBSTITUTE(B43,"(","")=B43,B43<>""),B43,LEFT(A43,FIND(" ",A43)))
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  4. #4
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Extracting data from cells based on criteria in other cells

    Okay so here's the answer
    Try this in D43 copied down--
    =IF(AND(SUBSTITUTE(B43,"(","")=B43,B43<>""),B43,LEFT(A43,FIND(" ",A43)))

  5. #5
    Registered User
    Join Date
    06-23-2015
    Location
    Ecuador
    MS-Off Ver
    2011
    Posts
    10

    Re: Extracting data from cells based on criteria in other cells

    Thanks sourabhg98, but from what I can tell, that just checks to see if column B has a "(". I also need it to check if there are characters before the "(".

  6. #6
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Extracting data from cells based on criteria in other cells

    Ohh i forgot that
    Then it should be this--
    Please Login or Register  to view this content.

  7. #7
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Extracting data from cells based on criteria in other cells

    Slightly shorter--
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-23-2015
    Location
    Ecuador
    MS-Off Ver
    2011
    Posts
    10

    Re: Extracting data from cells based on criteria in other cells

    Thank you both for your help! I'm going through them right now and just making sure I understand how they work. Thanks again!

  9. #9
    Registered User
    Join Date
    06-23-2015
    Location
    Ecuador
    MS-Off Ver
    2011
    Posts
    10

    Re: Extracting data from cells based on criteria in other cells

    Just a quick question for ChemistB: what is the reason why you picked mid over left?

  10. #10
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Extracting data from cells based on criteria in other cells

    Glad to know that helped!!
    Thanks for the reputation and feedback..
    Just to remove the last space slight editing-
    =IF(B43="",LEFT(A43,FIND(" ",A43)-1),IFERROR(LEFT(B43,IFERROR(FIND("(",B43)-2,LEN(B43))),LEFT(A43,FIND(" ",A43)-1)))

  11. #11
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Extracting data from cells based on criteria in other cells

    Just a quick question for ChemistB: what is the reason why you picked mid over left?
    I'm just more comfortable with MID. LEFT probably would have made more sense.

+ 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] =IF and =SUMIF formulas creating long long long data processing times.
    By comp in forum Excel Programming / VBA / Macros
    Replies: 32
    Last Post: 03-26-2014, 02:59 PM
  2. Shortening of long array formula by short formula
    By paradise2sr in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-29-2013, 05:51 AM
  3. Very Long If Formula for VBA
    By Floydlevedale in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-24-2013, 11:55 AM
  4. Formula too long
    By blivy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-16-2012, 09:51 AM
  5. Very long formula that needs to be put in VBA
    By Hudas in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-21-2012, 12:00 PM
  6. Long long formula not calc'ing all steps
    By jvautour in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-01-2009, 10:26 AM
  7. Formula is too long
    By rgrstvr in forum Excel General
    Replies: 1
    Last Post: 03-23-2009, 07:32 PM
  8. formula too long!
    By phil2006 in forum Excel General
    Replies: 8
    Last Post: 07-02-2006, 06:40 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