+ Reply to Thread
Results 1 to 14 of 14

Formula to sort lowest value of doublets

  1. #1
    Forum Contributor
    Join Date
    04-20-2017
    Location
    SWEDEN
    MS-Off Ver
    2016
    Posts
    123

    Formula to sort lowest value of doublets

    In A I determine if the customer is returning.
    They could be in the data 100's of times with a different price, or sometimes 2 of the same ie. "750" in the sample.

    I need to remove the lowest value/or one of 2 identical prices from every customer, so the ones that marked "this" in F would return Single in A - I only need 1 "Returning" pr customer.

    https://www.excelforum.com/attachmen...1&d=1652941718
    Attached Files Attached Files
    Last edited by HereComesTheBoom; 05-19-2022 at 02:30 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,469

    Re: Formula to sort lowest value of doublets

    Try this, copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,740

    Re: Formula to sort lowest value of doublets

    Do you have the MAXIFS function in your version of Excel? (I can't remember when it was introduced).

    Pete

  4. #4
    Forum Contributor
    Join Date
    04-20-2017
    Location
    SWEDEN
    MS-Off Ver
    2016
    Posts
    123

    Re: Formula to sort lowest value of doublets

    Quote Originally Posted by TMS View Post
    Try this, copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I might have worded it badly, english is not my first language, sorry.

    This gives me a cirklular ref. and, I dont need the word "this", only Single/Returning - the word "this" was to show which lines that should return "Single" instead of Returning

  5. #5
    Forum Contributor
    Join Date
    04-20-2017
    Location
    SWEDEN
    MS-Off Ver
    2016
    Posts
    123

    Re: Formula to sort lowest value of doublets

    Quote Originally Posted by Pete_UK View Post
    Do you have the MAXIFS function in your version of Excel? (I can't remember when it was introduced).

    Pete
    I do have it, sir

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,469

    Re: Formula to sort lowest value of doublets

    D2 copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    04-20-2017
    Location
    SWEDEN
    MS-Off Ver
    2016
    Posts
    123

    Re: Formula to sort lowest value of doublets

    Quote Originally Posted by TMS View Post
    D2 copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I might have described it badly, see this sample, might be better

    https://www.excelforum.com/attachmen...1&d=1652941718
    Attached Files Attached Files

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,001

    Re: Formula to sort lowest value of doublets

    Try this:

    =IF(AND(COUNTIF($C$2:$C2,C2)>1,E2<>MINIFS($E$2:$E$20,$C$2:$C$20,C2),COUNTIFS($C$2:$C2,C2,$A$1:$A1,"Returning")=0),"YES","")
    Attached Files Attached Files
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  9. #9
    Forum Contributor
    Join Date
    04-20-2017
    Location
    SWEDEN
    MS-Off Ver
    2016
    Posts
    123

    Re: Formula to sort lowest value of doublets

    That almost get's me there, but look at customer 541561 (C12 and C20) A12 should be returning
    Last edited by AliGW; 05-19-2022 at 02:56 AM. Reason: PLEASE don't quote unnecessarily!

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,001

    Re: Formula to sort lowest value of doublets

    Not according to your sample workbook. Look:

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    A
    B
    C
    D
    E
    F
    12
    Single
    541561
    5000.00
    13
    Returning
    6468
    YES
    750.00
    This should return single in A13, because it's 2 equal prices(750) and I only want 1 showing
    14
    Single
    6468
    750.00
    As long as just one is "Returning", this should work for you.
    15
    Single
    879
    81.00
    16
    Single
    7545451
    351.00
    17
    Single
    4664
    651.00
    18
    Single
    8944
    651.00
    19
    Single
    84968964
    1561.00
    20
    Single
    541561
    3000.00
    This should return single in A20, because it's the lowest price of the 2 on that customer
    Sheet: Ark1

  11. #11
    Forum Contributor
    Join Date
    04-20-2017
    Location
    SWEDEN
    MS-Off Ver
    2016
    Posts
    123

    Re: Formula to sort lowest value of doublets

    Hmm...

    I didn't mark it, because I thought I had worded it out, my bad
    But I NEVER want more than one price for a given customer, so If there is two prices ie. 541561, I want the highest marked "returning", all else as single

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,001

    Re: Formula to sort lowest value of doublets

    Try this:

    =IF(OR(COUNTIFS(C$2:C2,C2,E$2:E2,E2)>1,AND(COUNTIF($C$2:$C$20,C2)>1,E2<>MINIFS($E$2:$E$20,$C$2:$C$20,C2),COUNTIFS($C$2:$C2,C2,$A$1:$A1,"Returning")=0)),"YES","")
    Attached Files Attached Files

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,001

    Re: Formula to sort lowest value of doublets

    Actually, I think you need this:

    =IF(OR(AND(COUNTIFS(C$2:C2,C2,E$2:E2,E2)>1,E2<>MINIFS($E$2:$E$20,$C$2:$C$20,C2)),AND(COUNTIF($C$2:$C$20,C2)>1,E2<>MINIFS($E$2:$E$20,$C$2:$C$20,C2),COUNTIFS($C$2:$C2,C2,$A$1:$A1,"Returning")=0)),"YES","")
    Attached Files Attached Files

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,001

    Re: Formula to sort lowest value of doublets

    Thanks for the rep - I hope you saw post #13, because if not, I think you are going to hit snags.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 09-08-2020, 09:08 AM
  2. Find doublets in column and highlight all row
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-30-2020, 09:23 AM
  3. [SOLVED] Macro to find doublets and add the amount together
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-05-2016, 11:18 AM
  4. Replies: 1
    Last Post: 03-04-2015, 02:57 PM
  5. How to sort from highest to lowest
    By dneunabe in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 11-22-2013, 04:49 PM
  6. Excel 2007 : Count doublets
    By Sarianna in forum Excel General
    Replies: 7
    Last Post: 10-19-2011, 06:08 AM
  7. [SOLVED] Sort from lowest to highest
    By Steved in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-10-2005, 08:07 PM

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