Table:
0
A
B
C
D
E
1
Name
Tenure
Courtesy title
Court Rank
revenues
2
Naitō Masamitsu ( 内藤政苗 ? )
1749–1766
Tamba-no-kami
Lower 5th (従五位下)
20,000 koku
3
Naitō Satobumi ( 内藤学文 ? )
1766–1794
Yamashiro-no-kami
Lower 5th (従五位下)
20,000 koku
4
Naitō Masamichi ( 内藤政峻 ? )
1794–1813
Yamashiro-no-kami
Lower 5th (従五位下)
20,000 koku
5
Naitō Masanari ( 内藤政成 ? )
1813–1830
Yamashiro-no-kami
Lower 5th (従五位下)
20,000 koku
6
Naitō Masahiro ( 内藤政優 ? )
1830–1851
Tamba-no-kami
Lower 5th (従五位下)
20,000 koku
7
Naitō Masabumi ( 内藤政文 ? )
1851–1858
Yamashiro-no-kami
Lower 5th (従五位下)
20,000 koku
8
Naitō Masanari ( 内藤政成 ? )
1858–1871
Tamba-no-kami
Lower 5th (従五位下)
20,000 koku

Questions and formulas:
Question: What is the tenure of the person whose courtesy title is yamashiro-no-kami?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:E1,C1="yamashiro-no-kami"),2))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:E8,C2:C8="yamashiro-no-kami"),2))
Level: medium
Question: What is the courtesy title of the person whose tenure goes from 1766–1794?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:E1,B1="1766–1794"),3))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:E8,B2:B8="1766–1794"),3))
Level: medium