0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MATCH,INDEXの再定義を少し修正しました。

Last updated at Posted at 2020-01-28

以前投稿した記事の関数DI,MIを使い勝手が良いように修正しました。
なにが変わったかというと、Range名が文字列でも可能となりました。
文字列で可能ということは、さらに拡張するとマクロ的な表現が可能となります。

Function DI(R, I, Optional J = 1, Optional S = "")          ' DATA INDEX
    On Error Resume Next
    
    If TS_(R) Then Set R = Range(R)
    If I > 0 Then S = WorksheetFunction.Index(R, I, J)
    If TS_(R) Then S = ""
    DI = S
End Function

Function MI(R, V, Optional S = "")     ' MATCH INDEX
     On Error Resume Next
     If TS_(R) Then Set R = Range(R)
     
     S = WorksheetFunction.Match(V, R, 0)
     MI = S
End Function

Function TS_(M, Optional N = "", Optional L = "", Optional T = "String")
    TS_ = TR_(M, T) * TR_(N, T) * TR_(L, T)
End Function

Function TR_(R, Optional T = "Range")
    TR_ = (TypeName(R) = T)
End Function
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?