+ Reply to Thread
Results 1 to 11 of 11

Ranking Groups of Combined Positive and Negative Values

  1. #1
    Forum Contributor
    Join Date
    06-25-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016
    Posts
    615

    Ranking Groups of Combined Positive and Negative Values

    Hi Folks
    As the title suggests I need to Rank groups of values that may contain a mixture of both positive and
    negative values. Some may be all positive and some may be all negative as well.

    Workbook attached with sample layout-

    Cheers
    hammer
    Attached Files Attached Files
    If you have found solving my problem/s to be an interesting and educational exercise then how about Repping me up?
    No idea why I need Rep, other than feeling left out....

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,834

    Re: Ranking Groups of Combined Positive and Negative Values

    Try

    in E2

    =RANK($D2,OFFSET($A$1,MATCH(A2&B2&C2,$A$2:$A$1000&$B$2:$B$1000&$C$2:$C$1000,0),3,COUNTIFS($A:$A,$A2,$B:$B,$B2,$C:$C,$C2)))

    Enter with Ctrl+Shift+Enter
    copy down
    Attached Files Attached Files
    Last edited by JohnTopley; 11-24-2016 at 02:24 AM.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Ranking Groups of Combined Positive and Negative Values

    Nice 1 John, I was going to go the OFFSET rout, but was trying to think of another option
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,834

    Re: Ranking Groups of Combined Positive and Negative Values

    @Ford ... you probably will !!!!

  5. #5
    Forum Contributor
    Join Date
    06-25-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016
    Posts
    615

    Re: Ranking Groups of Combined Positive and Negative Values

    Thanks John
    That certainly works in the sample workbook but returns #N/A in the actual-
    Could you tell me what the ',3,' in the middle of the formula does please?
    I am actually using different reference Cols in the actual workbook but am certain they are adjusted correctly.

    Thanks

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,834

    Re: Ranking Groups of Combined Positive and Negative Values

    3 is the offset of column D from column A as I used $A$1 at the OFFSET reference. You could use $D$1 and set 3 to 0.

    Lesson to be learned: always post a true representation of your data!!!

  7. #7
    Forum Contributor
    Join Date
    11-21-2013
    Location
    zimbabwe
    MS-Off Ver
    Excel 2003
    Posts
    125

    Re: Ranking Groups of Combined Positive and Negative Values

    In E2
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Confirm with Ctrl+Shift+Enter
    Copy down

  8. #8
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,176

    Re: Ranking Groups of Combined Positive and Negative Values

    Or try this ...

    =COUNTIFS($A$2:$A$23,A2,$B$2:$B$23,B2,$C$2:$C$23,C2,$D$2:$D$23,">"&D2)+1

    Normal Enter.

  9. #9
    Forum Contributor
    Join Date
    06-25-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016
    Posts
    615

    Re: Ranking Groups of Combined Positive and Negative Values

    @Phuocam - Excellent formula! Thank you so very much

    @JohnT It is actually a true representation, just that I was inputting it to a different sheet where the layout/s slightly differ. This is why I asked how/why the ,3, worked
    because I figured (yes, I do that sometimes) that it was the reason for your formula not working in the sheet I was in!!!

    @soledad - Thank you also for your time and effort!

    I try to always run with formulas that do not require CSE- but being the dummy I am I cannot remember why

  10. #10
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,176

    Re: Ranking Groups of Combined Positive and Negative Values

    You're welcome.

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,834

    Re: Ranking Groups of Combined Positive and Negative Values

    CSE formulas formula can impact performance but unless the volumes are large there is little "practical" difference in performance.

    But I like Phuocam's solution: very neat!
    Last edited by JohnTopley; 11-24-2016 at 04:26 AM.

+ 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. NoobQ: Rank function treats negative values as positive values. Help!
    By lutonoodles in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-12-2013, 02:10 PM
  2. Looking for a positive value ABOVE negative values
    By ckatzman in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-05-2012, 08:54 PM
  3. Replies: 8
    Last Post: 07-28-2012, 03:22 PM
  4. Replies: 2
    Last Post: 06-18-2012, 04:26 PM
  5. Convert negative to positive in sheet containing both positive/negative numbers
    By sa02000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2010, 07:52 PM
  6. Ranking conditional groups... but negative figures...
    By tangcla in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-23-2008, 06:29 PM
  7. Replies: 4
    Last Post: 09-26-2005, 06:05 PM
  8. switching values from positive to negative
    By lob in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-18-2005, 07:06 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