Help us understand the problem. What is going on with this article?

RANGE関数をさらに拡張し組込む

RANGE関数を拡張する。の構文を拡張して、
Excelで関数型プログラミングに目覚めたかもしれない。(M言語編)のM言語関数
- Table.SelectColumns
- Table.Combine
の機能を QL_INITに組込みました。

Function QL_INIT(M, Optional N = 1, Optional L1 = 1, Optional L2 = 1, Optional MODE = 0, Optional S = "")
    On Error Resume Next
    If TR_(M) Then
        S = M
        S = QL_INIT(S, N, L1, L2)

    ElseIf TV_(M) Then
        S = QL_INIT(UBound(M, 1), N, L1, L2)

        For I = 1 To UBound(M, 1)
            For J = 1 To UBound(M, 2)
                If MODE = 1 And IsNumeric(M(I, J)) Then M(I, J) = Val(M(I, J))
                S(I, J) = M(I, J)
            Next J
        Next I

    ElseIf TS_(M) Then
        If InStr(M, "[") > 0 And InStr(M, "]") = Len(M) Then
            A = A_(Left(M, Len(M) - 1), "[")
            B = A_(A(1), ",")
            A = A_(A(0), "+")

            N1 = UBound(B) + 1
            M1 = 0

            ReDim K(UBound(A))

            For L = 0 To UBound(A)
                K(L) = Range(A(L)).Rows.Count
                M1 = M1 + K(L)
            Next L

            ReDim S(0 To M1, 1 To N1)

            For J = 1 To N1
                S(0, J) = B(J - 1)
                D = 0
                For L = O To UBound(A)
                    R = ""
                    Set R = Range(CC(A(L), "[", B(J - 1), "]"))
                    For I = 1 To K(L)
                        S(D + I, J) = DI(R, I)
                    Next I
                    D = D + K(L)
                Next L
            Next J

        ElseIf InStr(M, ",") = 0 Then
            S = QL_INIT(AT_(M), N, L1, L2, MODE)

        Else
            T = A_(M, ","): N1 = UBound(T) + 1
            U = A_(T(0), " "): M1 = UBound(U) + 1
            S = QL_INIT(M1, N1)

            For J = 0 To N1
                U = A_(T(J), " ")
                For I = 0 To M1
                    S(I + 1, J + 1) = U(I)
                Next I
            Next J
            S = QL_INIT(S, N, L1, 1, MODE)

        End If
    ElseIf TS_(N) Then
        T = A_(N, ","): N = UBound(T) + 1
        S = QL_INIT(M, N, 0, 1)
        For J = 1 To N: S(0, J) = T(J - 1): Next J    ' タイトル

    Else
        ReDim S(L1 To M, L2 To N)
        For J = L2 To N: For I = L1 To M: S(I, J) = "": Next I: Next J ' 初期化
    End If

    QL_INIT = S
End Function

Function A_(V, Optional D = " ")
    A_ = Split(TRIM_(V), D)
End Function

Function AT_(V, Optional D = " ")
    AT_ = WorksheetFunction.Transpose(A_(V,D))
End Function

image.png

matumoto_onga
Excel Insider 2011年まで某航空会社子会社のネットワーク技術者 2012年以降は旋盤工
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした