|
▼トキノハジメ さん:
こんばんは
もっとスマートな方法があるとは思いますが、とりあえず。
3つ一緒なら■にしてあります。
Sub Sample()
Dim c As Range
Dim s As String
Dim n1 As Long, n2 As Long, n3 As Long, nx As Long, nz As Long
For Each c In Range("A1", Range("A" & Rows.Count).End(xlUp))
n1 = WorksheetFunction.Rank(c.Value, c.Resize(, 3))
n2 = WorksheetFunction.Rank(c.Offset(, 1).Value, c.Resize(, 3))
n3 = WorksheetFunction.Rank(c.Offset(, 2).Value, c.Resize(, 3))
nx = n1 + n2 + n3
Select Case nx
Case 5
s = "△"
Case 3
s = "■"
Case Else
If n1 = 1 Then
s = "×"
ElseIf n2 = 1 Then
s = "○"
Else
s = "◎"
End If
End Select
c.Offset(, 3).Value = s
Next
End Sub
|
|