I have the following table in which I want to compare scores across simulations for multiple players. How can I get the number of times that Phil Mickelson has a lower R1Score than Justin Rose?
This needs to be done in a formula of sorts, not using any PivotTables. I would need to compare the R1Score for Phil and Justin for SimNum 1, 2, 3, etc. to see how many times he beats Justin. Any help would be greatly appreciated!
CodePudding user response:
If you have Office 365 you could use:
=SUM(IFERROR(--(FILTER(C2:C21,A2:A21="Phil Mickelson")>FILTER(C2:C21,A2:A21="Justin Rose")),0))
This is provided that the SimNum are in ascending order always.
If they're not in order but all values from 1 to x are present without any gaps, you could use the following:
=LET(value1,"Phil Mickelson",
value2,"Justin Rose",
data,A2:C21,
sorted,SORTBY(data,INDEX(data,,2)),
a,INDEX(sorted,,1),
c,INDEX(sorted,,3),
filter1,FILTER(c,a=value1),
filter2,FILTER(c,a=value2)
SUM(IFERROR(--(filter1>filter2),0)))
CodePudding user response:
If your version of Excel has dynamic arrays this is easy to solve.
Start with this formula:
=COUNTIFS($C$12:$C$21,">"&C2)
If we drag that down column D we get these numbers: 9, 8, 9, 6, 4, 4, 9, 0, 8, 2
i.e. Simulation 1 is better than 9 simulations of Justin Rose, simulation 2 is better than 8, simulation 10 is better than 2 etc.
With Dynamic Arrays, instead of just supplying the cell containing Phil's first simulation, we can now provide his entire simulation range as well. This will give us a dynamic array, containing the same numbers as our original COUNTIF formula. Take note that the range is surrounded by a blue border.
Now we just need to add all of these numbers together to show how many total simulations are better:
=SUM(COUNTIFS($C$12:$C$21,">"&C2:C11))