+ Reply to Thread
Results 1 to 6 of 6

reading partial cell

Hybrid View

  1. #1
    Registered User
    Join Date
    04-22-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    2

    Question reading partial cell

    This is my data:

    802208 aecl
    802208 W
    802330 aecl
    802330 W
    802474 aecl
    802474 W


    for every a in the second column, I need 001 in a separate column.
    for every e in the second column, I need 013 in a separate column.
    for every c in the second column, I need 005 in a separate column.
    for every l in the second column, I need 015 in a separate column.
    for every w in the second column, I need 003 in a separate column.

    I don't know how to tell Excel to look for and pick out a single letter in a cell.
    I tried this =IF(N2="a","001") but that only seems to take the entire cell into account.

    Also, I would like to add a suffix to the end of the first column based on the letters in the second column. This can be a separate task.

    802208 aecl
    802208 W
    802330 aecl
    802330 W
    802474 aecl
    802474 W

    If the second column has an a in it, I would like the first column to read 8022081.
    If the second column has an e in it, I would like the first column to read 802208C.
    If the second column has an l in it, I would like the first column to read 80220815.
    .
    .
    .

    Please help

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,464

    Re: reading partial cell

    To check contents of a cell try
    =IF(ISNUMBER(SEARCH("a",A1)),do_sthg, do_sthg_else)
    . If your search will be case sensitive use the fIND function

  3. #3
    Registered User
    Join Date
    04-22-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: reading partial cell

    Pepe, Thank you for the reply. I think I maybe should haev entered thsi in the new user forum. I did not understand your reply and could not get it to work. Could you explain a little clearer for a very novice user?

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: reading partial cell

    Your request isn't to clear, see if this workbook helps

    [EDIT]
    Forgot to sort the lookup arrays.
    Attachment now corrected.
    Attached Files Attached Files
    Last edited by Marcol; 04-22-2013 at 01:41 PM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: reading partial cell

    Hello

    What Pepe meant on using
    =IF(ISNUMBER(SEARCH("a",A1)),do_sthg, do_sthg_else)
    is something like
    =IF(ISNUMBER(SEARCH("a",A1)),"001", "")
    SEARCH function will lookup for the text within a text, and return the number of letter in which the text is found, for e.g. SEARCH "a" in "abcd" returns 1, "a" in "dcba" returns 4, and "a" in bcd returns #VALUE! (not found).
    Basing on that idea, Pepe put a ISNUMBER trap in front of it, testing whether SEARCH returns a number (Text is found) or not (Text is not found).
    Everything else is just function of IF. You can read it like this: IF(Find "a" in text, what to do if it's found, what to do if it's not found).
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,464

    Re: reading partial cell

    I must admit a was lazy when answering . Thanks to Lemice for explaining

+ 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