関数をセルの範囲で実行したいのですが、次の場合:
いずれかが
NormalValue
「低すぎる」を返します。NormalValue
範囲内の最大値の 2 倍より大きい場合は、「高すぎます」を返します。- どちらも真でない場合は、'OK' を返します。
これは私がこれまでに思いついたものです:
Function TooHighLow(rng As range, NormalValue As Double)
For Each cell In rng
If Application.WorksheetFunction.Max(cell.Value) > NormalValue Then
TooHighLow = "Too Low"
ElseIf NormalValue > 2 * (Application.WorksheetFunction.Max(cell.Value)) Then
TooHighLow = "Too High"
Else
TooHighLow = "OK"
End If
Next cell
End Function