+ Reply to Thread
Results 1 to 6 of 6

IF Match Function

  1. #1
    Forum Contributor
    Join Date
    10-30-2008
    Location
    Los Angeles
    Posts
    144

    IF Match Function

    I am trying to write a formula that says if a name is in a column of names put a 1 otherwise put 0. Should be a simple If, match function but having no luck.

    I have attached a simple example........

    thanks to all

    Max
    Attached Files Attached Files
    Last edited by maxthebear; 01-06-2010 at 08:16 PM.

  2. #2
    Valued Forum Contributor khamilton's Avatar
    Join Date
    10-08-2009
    Location
    IL
    MS-Off Ver
    Excel 2007
    Posts
    345

    Re: IF Match Function

    Put this in H5 =IF(G5=$E$5:$E$9,1,0) and copy down
    Please acknowledge the response you receive, good or bad. If your problem is solved, please say so clearly, and 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. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: IF Match Function

    Hi, you could use

    =IF(COUNTIF(E5:E9,G5),1,0)

    If you use match instead of countif, you will have to cater for non-found values and wrap match into another formula, something like

    =IF(ISNA(MATCH(G5,E5:E9,0)),0,1)

    hth

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: IF Match Function

    khamilton, not quite.

    In the example file put "Nancy" in E9. Now H6 should return a 1 but it does not.

    Run your formula through the Evaluate Formula tool and see that only the value of the same row is compared, but not the values of the complete range.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: IF Match Function

    Quote Originally Posted by khamilton View Post
    Put this in H5 =IF(G5=$E$5:$E$9,1,0) and copy down
    That only seems to work because the OP's matches are on the same rows in the example data, your formula isn't actually an array, it is just matching the current row.

    You need this in H5 and then copied down:

    =ISNUMBER(MATCH(G5, E:E, 0))

    This will result in TRUE/FALSE answers. If you really need 1s and 0s:

    =IF(ISNUMBER(MATCH(G5, E:E, 0)), 1, 0)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  6. #6
    Valued Forum Contributor khamilton's Avatar
    Join Date
    10-08-2009
    Location
    IL
    MS-Off Ver
    Excel 2007
    Posts
    345

    Re: IF Match Function

    Thank you both!!!!

+ 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