web-dev-qa-db-ja.com

文字列の一部を抽出するためのArrayFormula

私は以下の式に出くわし、それが非常に便利であると思っています。すぐにそれを配列に変換したいのですが、実行する前に、これを行う簡単な方法があるかどうか疑問に思っていましたか?

=if(len(LEFT(MID(A2,SEARCH("02",A2)+2,LEN(A2)),SEARCH("37",MID(A2,SEARCH("02",A2)+2,
 LEN(A2)))-1))=14,LEFT(MID(A2,SEARCH("02",A2)+2,LEN(A2)),SEARCH("37",MID(A2,SEARCH("02",A2)+2,
 LEN(A2)))-1),if(len(LEFT(MID(A2,SEARCH("02",A2)+2,LEN(A2)),SEARCH("15",MID(A2,SEARCH("02",A2)+2,
 LEN(A2)))-1))=14,LEFT(MID(A2,SEARCH("02",A2)+2,LEN(A2)),SEARCH("15",MID(A2,SEARCH("02",A2)+2,
 LEN(A2)))-1),if(len(LEFT(MID(A2,SEARCH("02",A2)+2,LEN(A2)),SEARCH("10",MID(A2,SEARCH("02",A2)+2,
 LEN(A2)))-1))=14,LEFT(MID(A2,SEARCH("02",A2)+2,LEN(A2)),SEARCH("10",MID(A2,SEARCH("02",A2)+2,
 LEN(A2)))-1),"")))

説明に役立つGoogleドキュメント: https://docs.google.com/spreadsheets/d/1JWHnZAw6NPg6P657q4ipD2aqyypq1bip8Bi_8JD-1w8/edit?usp=sharing

これ 変更されたコード:

=ARRAYFORMULA(
 IF(LEN(IFERROR(REGEXEXTRACT(A2:A&"", "37(.*)02")))=(len(right(A2:A,((len(A2:A))-(find(37,A2:A)))-1))), 
                int((REGEXEXTRACT(A2:A&"", "37(.*)02"))),
 IF(LEN(IFERROR(REGEXEXTRACT(B2:B&"", "37(.*)02")))=(len(right(B2:B,((len(B2:B))-(find(37,B2:B)))-1))),
                int((REGEXEXTRACT(B2:B&"", "37(.*)02"))),
 IF(LEN(IFERROR(REGEXEXTRACT(C2:C&"", "37(.*)02")))=(len(right(C2:C,((len(C2:C,))-(find(37,C2:C,)))-1))),
                int((REGEXEXTRACT(C2:C&"", "37(.*)02"))),
IF(LEN(IFERROR(REGEXEXTRACT(A2:A&"", "37(.*)15")))=(len(right(A2:A,((len(A2:A))-(find(37,A2:A)))-1))), 
                int((REGEXEXTRACT(A2:A&"", "37(.*)15"))),
 IF(LEN(IFERROR(REGEXEXTRACT(B2:B&"", "37(.*)15")))=(len(right(B2:B,((len(B2:B))-(find(37,B2:B)))-1))),
                int((REGEXEXTRACT(B2:B&"", "37(.*)15"))),
 IF(LEN(IFERROR(REGEXEXTRACT(C2:C&"", "37(.*)15")))=(len(right(C2:C,((len(C2:C))-(find(37,C2:C)))-1))),
                int((REGEXEXTRACT(C2:C&"", "37(.*)15"))),
IF(LEN(IFERROR(REGEXEXTRACT(A2:A&"", "37(.*)10")))=(len(right(A2:A,((len(A2:A))-(find(37,A2:A)))-1))), 
                int((REGEXEXTRACT(A2:A&"", "37(.*)10"))),
 IF(LEN(IFERROR(REGEXEXTRACT(B2:B&"", "37(.*)10")))=(len(right(B2:B,((len(B2:B))-(find(37,B2:B)))-1))),
                int((REGEXEXTRACT(B2:B&"", "37(.*)10"))),
 IF(LEN(IFERROR(REGEXEXTRACT(C2:C&"", "37(.*)10")))=(len(right(C2:C,((len(C2:C))-(find(37,C2:C)))-1))),
                int((REGEXEXTRACT(C2:C&"", "37(.*)10"))),
IF(LEN(IFERROR(REGEXEXTRACT(A2:A&"", "37(.*)11")))=(len(right(A2:A,((len(A2:A))-(find(37,A2:A)))-1))), 
                int((REGEXEXTRACT(A2:A&"", "37(.*)11"))),
 IF(LEN(IFERROR(REGEXEXTRACT(B2:B&"", "37(.*)11")))=(len(right(B2:B,((len(B2:B))-(find(37,B2:B)))-1))),
                int((REGEXEXTRACT(B2:B&"", "37(.*)11"))),
 IF(LEN(IFERROR(REGEXEXTRACT(C2:C&"", "37(.*)11")))=(len(right(C2:C,((len(C2:C))-(find(37,C2:C)))-1))),
                int((REGEXEXTRACT(C2:C&"", "37(.*)11"))),
IF(LEN(IFERROR(REGEXEXTRACT(A2:A&"", "37(.*)")))=(len(right(A2:A,((len(A2:A))-(find(37,A2:A)))-1))), 
                int((REGEXEXTRACT(A2:A&"", "37(.*)"))),
 IF(LEN(IFERROR(REGEXEXTRACT(B2:B&"", "37(.*)")))=(len(right(B2:B,((len(B2:B))-(find(37,B2:B)))-1))),
                int((REGEXEXTRACT(B2:B&"", "37(.*)"))),
 IF(LEN(IFERROR(REGEXEXTRACT(C2:C&"", "37(.*)")))=(len(right(C2:C,((len(C2:C))-(find(37,C2:C)))-1))),
                int((REGEXEXTRACT(C2:C&"", "37(.*)"))),










 ))))))))))))))))
1
Ceebee86
=ARRAYFORMULA(
 IF(LEN(IFERROR(REGEXEXTRACT(A2:A&"", "02(.*)37")))=14, 
                REGEXEXTRACT(A2:A&"", "02(.*)37"),
 IF(LEN(IFERROR(REGEXEXTRACT(B2:B&"", "02(.*)37")))=14,
                REGEXEXTRACT(B2:B&"", "02(.*)37"),
 IF(LEN(IFERROR(REGEXEXTRACT(C2:C&"", "02(.*)37")))=14,
                REGEXEXTRACT(C2:C&"", "02(.*)37"), ))))

0

1
user0