Results 1 to 10 of 20

Thread: How to calculate best bowling figure (cricket)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Junior Member
    Join Date
    Sep 2021
    Posts
    9
    Rep Power
    0
    Quote Originally Posted by ahmedleo414 View Post
    I need to figure out a way to calculate the best bowling figure, Most wickets taken with least number of runs

    In this case the best figure would be from Match 3, and the result would be 32-3
    Hi,

    Try This
    IF YOU ARE USING OFFICE 365 NO NEED TO PRESS CTRL + SHIFT + ENTER OTHERWISE AFTER ENTERING FORMULA PRESS CTRL + SHIFT + ENTER

    =SMALL(IF(E2:E21=MAX(E2:E21),$D$2:$D$21,""),1)&"-"&MAX(E2:E21)

    Code for UDF

    Function BBI(wkts_range As Range, runs_range As Range) As String
    Dim runs_array As Variant
    ReDim runs_array(1 To wkts_range.Count)
    maxwkt = Application.WorksheetFunction.Max(wkts_range)
    Row = 1
    For i = 1 To wkts_range.Count
    If wkts_range.Cells(i, 1) = maxwkt Then
    runs_array(Row) = runs_range.Cells(i, 1)
    Row = Row + 1
    End If
    Next i
    minruns = Application.WorksheetFunction.Min(runs_array)
    BBI = minruns & "-" & maxwkt
    End Function

    Code:
    Function BBI(wkts_range As Range, runs_range As Range) As String
    Dim runs_array As Variant
    ReDim runs_array(1 To wkts_range.Count)
        maxwkt = Application.WorksheetFunction.Max(wkts_range)
        Row = 1
        For i = 1 To wkts_range.Count
            If wkts_range.Cells(i, 1) = maxwkt Then
                runs_array(Row) = runs_range.Cells(i, 1)
                Row = Row + 1
            End If
        Next i
    minruns = Application.WorksheetFunction.Min(runs_array)
    BBI = minruns & "-" & maxwkt
    End Function
    =bbi(E2:E21,D2:D21)
    Attached Files Attached Files
    Last edited by DocAElstein; 09-04-2021 at 12:16 PM. Reason: Chidambaram3983:- Formula Simplified ..... Alan:- [Code] [/code] tags

Similar Threads

  1. Replies: 7
    Last Post: 06-17-2019, 04:34 PM
  2. Replies: 1
    Last Post: 04-24-2013, 04:34 PM
  3. Calculate the Hours
    By leopaulc in forum Excel Help
    Replies: 2
    Last Post: 02-27-2013, 02:51 PM
  4. Runtime Error 481 invalid figure when PNG
    By Tony in forum Excel Help
    Replies: 0
    Last Post: 02-12-2013, 12:59 AM
  5. Add Overs in Cricket
    By MrDelhi in forum Excel Help
    Replies: 1
    Last Post: 07-15-2011, 09:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •