+ Reply to Thread
Results 1 to 5 of 5

How to find out the duplicate number and show it in a new cell?

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    How to find out the duplicate number and show it in a new cell?

    1.jpg
    I have a row with four number A1 is 1, B1 is 26, C1 is 102 and D1 is 26. How can I find out the duplicate number 26 and show it in a new cell? Also I want to find out the cell which is greater then 100 and combine with the duplicate number shown as 26,102 in F1.
    Attached Images Attached Images

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

    Re: How to find out the duplicate number and show it in a new cell?

    Put this formula in F1:

    =LOOKUP(2, 1/(COUNTIF(A1:D1,A1:D1)>1), A1:D1) & "," & LOOKUP(2, 1/(A1:D1>100), A1:D1)
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    08-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How to find out the duplicate number and show it in a new cell?

    Thanks for your help. It works perfectly. Can you explain why do you put 2 and 1 over countif? Thanks again.

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

    Re: How to find out the duplicate number and show it in a new cell?

    It's a "trick" formula, you can use the Evaluate Formula function to watch it unfold, it may become clearer what it is doing as you watch.


    The LOOKUP function has a "fuzzy" built into it. So if you search for the number 2 and don't find it, the formula will spot the last instance of the next lower number.

    The second parameter is creating an array of answers TRUE/FALSE answers. 1/TRUE = 1, 1/FALSE = Error.

    This gives you an array like {Error, 1, Error, 1}. Now the LOOKUP is looking for 2, can't find it, so settled for the last "1" in that array, so position 4. Then is uses the last parameter and pulls the value from 4th position of that array.

  5. #5
    Registered User
    Join Date
    08-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How to find out the duplicate number and show it in a new cell?

    That's a brilliant idea. So lookup(1.. also works in this case.

+ 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