Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Brute force and ignorance but it does it.
Extending to more cars/drivers gets very tedious. A little more finesse anyone. Sub assignDriver() Dim driverName(4) As String Dim i As Integer 'Assign driver names to array driverName(1) = "Steve" driverName(2) = "Mary" driverName(3) = "Craig" driverName(4) = "Alison" 'Write headings Cells(1, 1) = "index" Cells(1, 2) = "Car1" Cells(1, 3) = "Car2" Cells(1, 4) = "Car3" Cells(1, 5) = "Car4" i = 0 For driverCar1 = 1 To 4 For driverCar2 = 1 To 4 If driverCar2 < driverCar1 Then For driverCar3 = 1 To 4 If driverCar3 < driverCar1 Then If driverCar3 < driverCar2 Then For driverCar4 = 1 To 4 If driverCar4 < driverCar1 Then If driverCar4 < driverCar2 Then If driverCar4 < driverCar3 Then i = i + 1 Cells(i + 1, 1) = i Cells(i + 1, 2) = driverName(driverCar1) Cells(i + 1, 3) = driverName(driverCar2) Cells(i + 1, 4) = driverName(driverCar3) Cells(i + 1, 5) = driverName(driverCar4) End If End If End If Next driverCar4 End If End If Next driverCar3 End If Next driverCar2 Next driverCar1 End Sub "Mark" wrote: I am NOT a seasoned user, so forgive me if this questions is too simple: I have 4 cars and 4 drivers. I want Excel to fill-out the possibilities of drivers. 1 = Steve 2 = Mary 3 = Craig 4 = Allison If I remember from my Algebra days, there should be 24 independent results (1x2x3x4= 24) Please Help |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Create a conditional formula that results in another calculation | Excel Worksheet Functions | |||
Create a Table of Results | Excel Discussion (Misc queries) | |||
Can I create a display box to see results no matter where I am in | Excel Discussion (Misc queries) | |||
How to create independent worksheets using data in columns in a s. | Excel Worksheet Functions | |||
create sheet from autofilter results | Excel Discussion (Misc queries) |