+ Reply to Thread
Results 1 to 5 of 5

Assign value for data that starts with a certain letter

  1. #1
    Registered User
    Join Date
    01-10-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    2

    Assign value for data that starts with a certain letter

    If the data in a column starts with a certain Number or Letter, how can I get it to put a value in another column?

    I have a large database and need to take all the data in a column that starts with the letter P and in a separate column assign it another value.

    So for all data that starts with P, in the column specified put the letter N.

    Thanks!
    Last edited by Steve Bostwick; 01-10-2011 at 12:19 PM.

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

    Re: Assign value for data that starts with a certain letter

    Let's say your data starts in D2. Then in the other column

    =IF(LEFT(D2,1)="P","N", "")
    Does that work for you?
    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 martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Assign value for data that starts with a certain letter

    if its just one leter you could just use find p replace n
    or with data in a1
    if(left(a1,"p"),a1,"") to extract all those with p
    or say
    if(left(a1,"p"),"n"&RIGHT(A1,LEN(A1)-1),"")
    im not sure if you want to replace p or just identify it tho as chemistb has done
    "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 Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Assign value for data that starts with a certain letter

    Or do you have a series of letters where each one would get a designated letter? In that case, you'd need to set up a nested IF statement (if the list is short) or do a Lookup (if the list is longer).

  5. #5
    Registered User
    Join Date
    01-10-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Assign value for data that starts with a certain letter

    Quote Originally Posted by ChemistB View Post
    Let's say your data starts in D2. Then in the other column

    =IF(LEFT(B2,1)="P","N", "")
    Does that work for you?
    That's exactly what I was trying to do! Thank you.

+ 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