リクエストは簡単なVLOOKUP
関数で処理できます。
ステップ1:Sheet2で、列C(別名列 "Chan")をコピーしてワークシートの先頭に配置します。これで、Sheet2データは次のようになります。
Chan ttc event
30 XYZ L
40 XYZ L
6 XYZ L
ステップ2:Sheet1で、Sheet1の最後に列(列Fである必要があります)を追加し、「ttc」という名前を付けます(これは、Sheet2から検索するものであるため)。これで、Sheet1データは次のようになります。
Date ID Other Sub Chan ttc
10000 100 Repeat X 30
10000 101 Repeat X 40
ステップ3:Sheet1の列Fに次の関数を入力します
=VLOOKUP(E2,Sheet2!$A$2:$C$4,2,)
この数式を入力すると、結果がすぐに表示されます
Explanation: the Excel Vlookup function takes the following four arguments, which are
separated with a comma:
1st argument is the cell (E2) containing the value in Sheet 1 to look for
2nd argument contains the range of data to look into (which resides in Sheet2 and the
cell range A2 through C4 is where the data resides.
NOTE1: the VLOOKUP function requires the 1st column of Sheet2 to be the column
to look into
NOTE2: we don't need to include the 1st row containing the header
NOTE3: the dollar signs represent absolute cell range so that when you copy it
down to other rows below them, they don't change (i.e., your data range
in Sheet2 is always the same
3rd argument represents the column # in Sheet2 to return if there's a match.
NOTE: column 1 starts with column A of Sheet2
4th argument is left blank
ステップ4:この数式を以下の列Fの他のすべての行にコピーします注:後続の行には数式が含まれている必要があります
=VLOOKUP(F2,Sheet2!$A$2:$C$4,2,)
=VLOOKUP(G2,Sheet2!$A$2:$C$4,2,) if you have 3 rows in Sheet1
=VLOOKUP(H2,Sheet2!$A$2:$C$4,2,) if you have 4 rows in Sheet1
等...