所以,我还没想出该怎么做。
基本上,我想要这样的东西:
P1 P2 P3 TOTAL SCORE
-- -- -- P1 P2 P3
21 / 13 1 2 0
/ 17 10
6 7 /因此,这三列必须相互比较( "/“表示玩家没有玩该游戏,但不需要打印),其中最大的一列在总分选项卡中得到+1值。
另外,有比比较一个细胞和另一个细胞更容易做到这一点的方法吗?我的意思是,是否有可能在所有三列上拖动和标记所有单元格,并确保它们只比较同一行三列中的单元格?
发布于 2018-10-18 12:59:03
让我们假设数据出现在Sheet1中的图片中(不要更改结构):

尝试:
Option Explicit
Public Sub Process_Data(ByVal I_Value As Long)
Dim LastRow As Long
Dim i As Long
Dim CA As Integer
Dim CB As Integer
Dim CC As Integer
With Sheet1
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
For i = I_Value To LastRow '<= Lets say that the first score is at sheet1 column A row 3.LastRow represent the row of the last data in column A
CA = 0
CB = 0 '<= Every time that i change value we zero our variables to get the new value
CC = 0
If .Range("A" & i).Value = "/" Then '<= Check if there is a number or "/".if there is "/" we zero variable
CA = 0
Else
CA = .Range("A" & i).Value
End If
If .Range("B" & i).Value = "/" Then
CB = 0
Else
CB = .Range("B" & i).Value
End If
If .Range("C" & i).Value = "/" Then
CC = 0
Else
CC = .Range("C" & i).Value
End If
If CA > CB And CA > CC Then ' <= Check which number is bigger
.Range("E3").Value = .Range("E3").Value + 1 '<= At one point to each category
ElseIf CB > CA And CB > CC Then
.Range("F3").Value = .Range("F3").Value + 1
ElseIf CC > CA And CC > CB Then
.Range("G3").Value = .Range("G3").Value + 1
End If
Next i
End With
End Sub
Sub Evaluation()
Dim Value As Long
Dim LastRow As Long
LastRow = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
If (LastRow = 2) Or (LastRow = Sheet2.Range("A1").Value) Then '<= Check if the table has new data
Exit Sub
Else
If Sheet2.Range("A1").Value = "" Then '<=Check which value will adopt be i
Value = 3
Else
Value = Sheet2.Range("A1").Value + 1
End If
End If
Call Process_Data(I_Value:=Value)
Sheet2.Range("A1").Value = Sheet1.Range("A" & Rows.Count).End(xlUp).Row '<= Record the lastrow processed out
End Sub发布于 2018-10-18 12:31:04
使用大型函数为左边的单个游戏找到最高的数字。然后使用右边的IF语句检查大型函数的值是否与玩家的游戏分数匹配。如果匹配(TRUE),则赋值1。如果不匹配(FALSE),则赋值0。然后用IF函数对每个玩家指定的修饰符进行求和。
如果在单个游戏的分数中有可能出现平局,那么您还需要嵌套另一个If函数来处理这种可能性。
https://stackoverflow.com/questions/52873754
复制相似问题