+ Reply to Thread
Results 1 to 9 of 9

My if/and function isn't working???

  1. #1
    Registered User
    Join Date
    07-06-2009
    Location
    Columbus, OH
    MS-Off Ver
    Excel 2003
    Posts
    14

    My if/and function isn't working???

    this is the function i am trying to use =if(AND(A2=A3,L2=L3,M2=M3,N2=N3),"DUPE",0))


    A= id
    L= street address
    M=unit number to the address
    N=city

    I am trying to do this and it is leaving me with a lot of duplicates.

  2. #2
    Registered User
    Join Date
    07-06-2009
    Location
    Columbus, OH
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: My if/and function isn't working???

    i only have 1 paranthesis at the end not the double

  3. #3
    Forum Contributor mubashir aziz's Avatar
    Join Date
    03-18-2009
    Location
    Lahore, Pakistan
    MS-Off Ver
    MS Office 2013
    Posts
    533

    Re: My if/and function isn't working???

    Hi,

    formula is working nicely. can you be more specific to explain what you exactly needs .... here in above example IF condition will give you dup if all cells will be equal but if you want to show dupe if any one cell is equal then use OR ....
    But good approach is to attach a sample file with your requirements ....
    If this post helps, Please don't 4get to click the star icon located at the bottom left of my Post.

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: My if/and function isn't working???

    What do you mean it is leaving you with a lot of duplicates? What were you expecting it to do?

    Your formula simply checks those four columns in that row, and if they match the cells from the rows below, show "DUPE" in the cell with the formula. If not, show 0.

  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: My if/and function isn't working???

    The problem I always run into when comparing text strings is invisible but pesky extra spaces. The only way to be sure is to TRIM() every reference. A pain, but it gives you something reasonable to compare.

    Try this:

    =IF(AND(TRIM(A2)=TRIM(A3),TRIM(L2)=TRIM(L3),TRIM(M2)=TRIM(M3),TRIM(N2)=TRIM(N3)), "DUPE", 0)


    Or maybe this:

    =IF(TRIM(A2&L2&M2&N2)=TRIM(A3&L3&M3&N3),"DUPE", 0)
    Last edited by JBeaucaire; 07-08-2009 at 12:48 AM.
    _________________
    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
    Registered User
    Join Date
    07-06-2009
    Location
    Columbus, OH
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: My if/and function isn't working???

    Sorry it is leaving me with a lot of dupes when I filter with 0. I am trying to filter out duplicate ids with the same exact address.
    Attached Files Attached Files

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

    Re: My if/and function isn't working???

    I would use this instead:

    =IF(OR(TRIM(A2&L2&M2&N2)=TRIM(A3&L3&M3&N3),A2=""),"DUPE", 0)
    ...copied all the way down.

    This is text string data. There is always going to be stuff you have to fix. Like rows 235-247...different spellings of the same address.

    76-77, different city for the same address?

    103 and 107 match, but aren't adjacent, so your formula doesn't take that into account. Perhaps sorting the data by the address field?

    Address books are always fun to edit.
    Last edited by JBeaucaire; 07-08-2009 at 01:06 AM.

  8. #8
    Forum Contributor mubashir aziz's Avatar
    Join Date
    03-18-2009
    Location
    Lahore, Pakistan
    MS-Off Ver
    MS Office 2013
    Posts
    533

    Re: My if/and function isn't working???

    Try this code ... hope it will solve your problem ......
    R2=IF(SUMPRODUCT(($A$2:$A$2493=A2)*($L$2:$L$2493=L2)*($M$2:$M$2493=M2)*($N$2:$N$2493=N2))>1,"DUPE","")
    copy this code in R2 and drag downward ......

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

    Re: My if/and function isn't working???

    10k calculations per cell...and 2500 of those....egad! No, just sort the data and use a formula like the one already being attempted.

    Egad!

+ 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