回答編集履歴

3

追記

2021/11/20 01:31

投稿

jinoji
jinoji

スコア4592

test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ```Excel
6
6
 
7
- =matching($A$2:$A$9,$E$2:$E$5,ROW()-1) 
7
+ [D2] =matching($A$2:$A$9,$E$2:$E$5,ROW()-1) 
8
8
 
9
9
  ```
10
10
 
@@ -47,3 +47,11 @@
47
47
 
48
48
 
49
49
  ---
50
+
51
+ 最新版のExcelでスピル関数が使える場合
52
+
53
+ ```Excel
54
+
55
+ [D2] =IFERROR(UNIQUE(INDEX($A:$A,SORT(IF(COUNTIF($E:$E,$A$2:$A$9)=0,ROW($A$2:$A$9),NA)))),"")
56
+
57
+ ```

2

追記

2021/11/20 01:31

投稿

jinoji
jinoji

スコア4592

test CHANGED
@@ -1,6 +1,10 @@
1
+ ---
2
+
3
+ VBAでユーザ定義関数を作る場合
4
+
1
5
  ```Excel
2
6
 
3
- =matching($A$2:$A$9,$E$2:$E$5,ROW()-1)
7
+ =matching($A$2:$A$9,$E$2:$E$5,ROW()-1) 
4
8
 
5
9
  ```
6
10
 
@@ -23,3 +27,23 @@
23
27
  End Function
24
28
 
25
29
  ```
30
+
31
+
32
+
33
+ ---
34
+
35
+ ワーク列を用いる場合
36
+
37
+ ```Excel
38
+
39
+ [G2] =IF(AND(COUNTIF($E:$E,$A2)=0,COUNTIF(OFFSET($A:$A,0,0,ROW($A2)-1),$A2)=0),ROW(),"")
40
+
41
+ [H2] =MIN(OFFSET($G:$G,N(H1),0,COUNTA($A:$A)-N(H1)))
42
+
43
+ [D2] =IFERROR(INDEX($A:$A,H2),"")
44
+
45
+ ```
46
+
47
+
48
+
49
+ ---

1

修正

2021/11/20 01:05

投稿

jinoji
jinoji

スコア4592

test CHANGED
@@ -5,8 +5,6 @@
5
5
  ```
6
6
 
7
7
  ```vba
8
-
9
-
10
8
 
11
9
  Function matching(a, b, c)
12
10
 
@@ -20,6 +18,8 @@
20
18
 
21
19
  Next
22
20
 
21
+ matching = ""
22
+
23
23
  End Function
24
24
 
25
25
  ```