Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hello,
Is there a way to shift the range for the rank function according to criteria? Example: Rank a given number within a range of other cells that are alike. For example, rank all numbers where the value in column A is XYZ. The formula will need to be dynamic so that once it hits row 5, it would now rank everything where the value in column A is ABC. Essentially, somehow the range needs to examine a list of data and then identify all circumstances that are alike, and return a cell location. It may make things easier to know that my data is in sequential order, ie column A sorted least to greatest. However, if this were to change, the ranking function must still work. There will always be 12 instances of the value in column A. So, 12 XYZs, 12 ABCs, etc. Maybe it would be easier to return the first greatest value of all XYZs, then the second, etc? Example of how the data may look: A......B......C(The rank that should be returned) XYZ...5......3 XYZ...2......2 XYZ...7......4 XYZ...1......1 ABC..1......1 ABC..8......3 ABC..3......2 123...11.....2 123...20.....3 123...5.......1 Thanks for your help, and congratulations if you can understand what Im trying to say;) -S |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hello,
Search for Bernie's function Rankif in this newsgroup. HTH, Bernd |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Sad to report that the information I am trying to rank is spread across
more than one column. Right now Im using this formula: =SUMPRODUCT(--(A:A=A4),--(N4<B:B))+1 .... can this be modified to take into account C:C, D:D, and E:E, so that A4 is ranked out of the results of all of those columns? S Davis wrote: Thanks, will do! -S wrote: Hello, Search for Bernie's function Rankif in this newsgroup. HTH, Bernd |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Can this VB code (courtesy of Bernie) be modified to accept 2 or more
ranges? Function RankIf(RankCell As Range, _ RankRange As Range, _ CritRange As Range, _ Criteria As Variant, _ Optional DescOrder As Boolean = True) As Integer '=RankIf(A1,$A$1:$A$10,$B$1:$B$10,"A", True) ' 'Where A1 has the number to be ranked, 'A1:A10 has the numbers against which A1 is to be ranked 'B1:B10 have the criteria '"A" is the criteria (which can also be a Cell reference) 'True means smaller values get lower rank numbers, False would be the 'opposite ' 'The function can be copied just like a regular function, and will return 0 'if the number to be ranked doesn't meet the criteria. Dim i As Integer Dim myRange As Range On Error GoTo notRanked For i = 1 To CritRange.Count If CritRange(i) = Criteria Then If myRange Is Nothing Then Set myRange = RankRange(i) Else Set myRange = Union(myRange, RankRange(i)) End If End If Next i RankIf = Application.WorksheetFunction.Rank(RankCell, myRange, DescOrder) Exit Function notRanked: RankIf = 0 End Function -S S Davis wrote: Sad to report that the information I am trying to rank is spread across more than one column. Right now Im using this formula: =SUMPRODUCT(--(A:A=A4),--(N4<B:B))+1 ... can this be modified to take into account C:C, D:D, and E:E, so that A4 is ranked out of the results of all of those columns? S Davis wrote: Thanks, will do! -S wrote: Hello, Search for Bernie's function Rankif in this newsgroup. HTH, Bernd |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Assuming that for each row you'd like the sum of the row to be ranked
against the sum of each row, try... =SUMPRODUCT(--($A$2:$A$10=A2),--(SUM(B2:E2)<SUBTOTAL(9,OFFSET($B$2:$E$10, ROW($B$2:$E$10)-ROW($B$2),0,1))))+1 Note that SUMPRODUCT does not accept whole column references. Hope this helps! In article . com, "S Davis" wrote: Sad to report that the information I am trying to rank is spread across more than one column. Right now Im using this formula: =SUMPRODUCT(--(A:A=A4),--(N4<B:B))+1 ... can this be modified to take into account C:C, D:D, and E:E, so that A4 is ranked out of the results of all of those columns? |
#7
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Thanks Domenic,
I regrettingly rearranged my entire workbook to put those columns in need of ranking beside each other. Its a little more confusing to look at, but it now at least works (can set all 4 columns to one range) and I can summarize on another sheet with simple references (=). Thanks for all the help everyone. -S Domenic wrote: Assuming that for each row you'd like the sum of the row to be ranked against the sum of each row, try... =SUMPRODUCT(--($A$2:$A$10=A2),--(SUM(B2:E2)<SUBTOTAL(9,OFFSET($B$2:$E$10, ROW($B$2:$E$10)-ROW($B$2),0,1))))+1 Note that SUMPRODUCT does not accept whole column references. Hope this helps! In article . com, "S Davis" wrote: Sad to report that the information I am trying to rank is spread across more than one column. Right now Im using this formula: =SUMPRODUCT(--(A:A=A4),--(N4<B:B))+1 ... can this be modified to take into account C:C, D:D, and E:E, so that A4 is ranked out of the results of all of those columns? |
#8
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
You're very welcome! I didn't realize that the columns were not next to
each other. It may be possible to rank based on your original layout, however it may not be as efficient. If you'd like to try it, post back with the location of the ranges involved. In article . com, "S Davis" wrote: Thanks Domenic, I regrettingly rearranged my entire workbook to put those columns in need of ranking beside each other. Its a little more confusing to look at, but it now at least works (can set all 4 columns to one range) and I can summarize on another sheet with simple references (=). Thanks for all the help everyone. -S |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
sum the values of a range based upon multiple ranges and criteria | Excel Worksheet Functions | |||
Dynamic Range with unused formula messing up x axis on dynamic graph | Charts and Charting in Excel | |||
dynamic summed range based on a variable | Excel Worksheet Functions | |||
overtime formula based on dynamic date range? | Excel Worksheet Functions | |||
MIN within range based on criteria | Excel Discussion (Misc queries) |