+ Reply to Thread
Results 1 to 7 of 7

Compare first 4 characters question

  1. #1
    Registered User
    Join Date
    07-08-2011
    Location
    China
    MS-Off Ver
    Excel 2003
    Posts
    6

    Compare first 4 characters question

    First of all, thank you for your precious time.

    Second, this method must be applicable to not only english, but to korean, chinese as well.

    So here is what I want: there is a column A full of characters, I want to look each grid of them up in another column from another excel file — by comparing the first 4 characters, starting from the left.

    If the first 4 char is same, no matter how different the rest of them are different, I want a value returned such as "yes", if the first 4 isn't the same, no matter how exactly the rest are alike, want a value returned as "no".

    Example:

    look up Bohemian in: "Barack" "Hamas" "Bohener", the return value should be "yes".

    Your help would be greatly appreciated, thanks in advance, and BTW, if I did not make the issue clear, please reply and let me know.

  2. #2
    Registered User
    Join Date
    07-08-2011
    Location
    China
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Compare first 4 characters question

    Oh and, if there is less than 4 char, the yes shall be returned only all 1/2/3 char matches.

  3. #3
    Valued Forum Contributor
    Join Date
    05-23-2011
    Location
    Lahore PK
    MS-Off Ver
    Excel 2007, 2013
    Posts
    627

    Re: Compare first 4 characters question

    the attatch file may be helpful
    Attached Files Attached Files
    Azam
    If you want to say Thank you to a member, click the reputation icon (Star) in the left bottom of the post.
    For prompt answer, be descriptive, concise, short, direct, and to-the-point.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,632

    Re: Compare first 4 characters question

    Here, try this in B2 (according to AA example):

    =IF(A2="","", IF(COUNTIF($D$2:$I$28, LEFT(A2,4)&"*")>0,"yes","no"))

  5. #5
    Registered User
    Join Date
    07-08-2011
    Location
    China
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Compare first 4 characters question

    Quote Originally Posted by Azam Ali View Post
    the attatch file may be helpful
    Thanks Azam, your wonderful!

    Checking it out right now... getting back with feedback in some time...

  6. #6
    Registered User
    Join Date
    07-08-2011
    Location
    China
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Compare first 4 characters question

    Hat off once again to Azam, you saved my life LOL. Thanks, and thanks to other folks for your kind help!!!

  7. #7
    Valued Forum Contributor
    Join Date
    05-23-2011
    Location
    Lahore PK
    MS-Off Ver
    Excel 2007, 2013
    Posts
    627

    Re: Compare first 4 characters question

    welcome

    If your problem is solved, mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes.

+ 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