ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Still need help on outstanding question (https://www.excelbanter.com/excel-worksheet-functions/65898-still-need-help-outstanding-question.html)

Brad

Still need help on outstanding question
 
Posted last night - Subject "counting occurances" - What I'm trying to do to
count how many time "Car 1" will race "Car 2" , "Car 3", "Car 4", in about 70
different races.

Thanks in advance for helping!!

Bernie Deitrick

Still need help on outstanding question
 
Brad,

You could use a User-Defined-Function. Copy the code below into a codemodule in your workbook.
Then, with your race matrix in cells A1:E83, and the numbers 1 through 25 in I1:AG1, and 1 throough
25 in H2:H26, enter this formula into cell I2:

=Races($A$1:$E$83,I$1,$H2)

and copy to I2:AG26

HTH,
Bernie
MS Excel MVP

Function Races(Sched As Range, Car1 As Range, Car2 As Range) As Variant
Dim myRow As Range

Races = 0

If Car1.Value = Car2.Value Then
Races = ""
Exit Function
End If

For Each myRow In Sched.Rows
If Application.CountIf(myRow, Car1.Value) = 1 And _
Application.CountIf(myRow, Car2.Value) = 1 Then
Races = Races + 1
End If
Next myRow

End Function

"Brad" wrote in message
...
Posted last night - Subject "counting occurances" - What I'm trying to do to
count how many time "Car 1" will race "Car 2" , "Car 3", "Car 4", in about 70
different races.

Thanks in advance for helping!!





All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com