Forum Discussion

pevenden's avatar
pevenden
Copper Contributor
Nov 12, 2023

create custom formula

I would like to create this custom formula to calculate a points awarding system that automatically calculates. P and A are the variables in the formula.

Is this possible?

P = event finishing position
A = event attendance
Φ = fleet factor (B Fleet - 0.33; C Fleet - 0.15)

 

    • pevenden's avatar
      pevenden
      Copper Contributor

      HansVogelaar 

      Yeah, I was not much at math... so alot of the characters don't mean much to me... however...

      The formula creates a point system for overall points for a sailboat racing season. The points awarded are dependent on the number of entries in the race, and the position of each boat in that race. 

      there is a graph that has the detail but I am trying to put the formula into excel for easier calculation... 

       if it works that is.... 

       

      does that help?

       

      • djclements's avatar
        djclements
        Bronze Contributor

        pevenden If you have Excel for MS365, you can achieve the same results as the graph you've shared with the following formula:

         

        =LET(n, B1, k, B2,
        φ, IF(ISBLANK(k), 1, k),
        MAKEARRAY(n, n, LAMBDA(p,a,
           IF(p>a, "", IFERROR((p*(1-((50*a+4800)/98))+((a*(50*a+4800))/98)-1)/(a-1), 25)*φ))))

         

        ...where the attendance (A) is in cell B1 and the fleet factor (φ) is in cell B2. The results would look something like this:

         

        MAKEARRAY Chart with Conditional Formatting

         

        Conditional Formatting was applied to range C5:V24 to shade the empty string results blue using the following formula:

         

        =AND(NOT(ISBLANK(C5)), C5="")

         

        You could also create a custom LAMBDA function in Name Manager to award points to each team based on their finishing position for each race. For example, you could create a function called XPOINTS using the following formula:

         

        =LAMBDA(a,p,[φ],
           LET(
              k, IF(ISBLANK(φ), 1, φ),
              IFERROR((p*(1-((50*a+4800)/98))+((a*(50*a+4800))/98)-1)/(a-1), 25)*k
           )
        )

         

        ...then use it as follows:

         

        Custom LAMBDA Function

         

        The formula used in cell D4 in the screenshot above is:

         

        =XPOINTS(COUNTIF($A$4:$A$20, A4), B4, $B$1)

         

        ...where COUNTIF is used to calculate the total attendance (A) for each Race No.

         

        As for the Season Standings section shown above, the following formula was used in cell F4:

         

        =LET(
        u, UNIQUE(C4:C20),
        a, SORT(HSTACK(u, SUMIFS(D4:D20, C4:C20, u)), 2, -1),
        HSTACK(SEQUENCE(ROWS(u)), a))

         

        I've also attached the workbook for your convenience. Cheers!

  • peiyezhu's avatar
    peiyezhu
    Bronze Contributor
    . P and A are the variables ?
    or constant?

    I guess need some specific variables and expected result to understand this formula.
  • JoeUser2004's avatar
    JoeUser2004
    Bronze Contributor

    pevenden HansVogelaar 

     

    If you google "event finishing position" "event attendance" "fleet factor" with quotes, we find the HCA Competitive Ranking formula (click here).

     

    The formula (from page 1) is not proper math.  It might be parsed as follows:

     

     

    The formula f(x) calculates the points assigned to a participant based on the participant's position (P = 1 to A) in a race with "A" participants.

     

    The notation Sigma(f(x), for x=1 to 5) simply means:  sum the points from 5 races.

     

    In particular:  ``the system includes your best five regatta finishes. If you sail fifteen events, we take your very best results for your ranking``.

     

    The table below (from page 2) shows the expected f(x) before applying fleet factor (phi) for finishing positions (P) in races that have A=1 to 20 participants.  It is just an example.

     

     

    Note:  I don't know if it is implicitly suggesting that f(x) should be rounded to 3 decimal places.  Further reading might be necessary.

     

    "The remainder of the solution is left as an excercise for the student". (wink)

Share