Table:
0
A
B
C
D
E
F
1
District
Incumbent
Party
First elected
Result
Candidates
2
New York 3
Jonathan Ward
Democratic-Republican
1814
Retired Democratic-Republican hold
Caleb Tompkins (DR) 56.8% Abraham Odell (F) 42.8%
3
New York 6
James W. Wilkin
Democratic-Republican
1815 ( special )
Re-elected
James W. Wilkin (DR) 55.4% James Burt (F) 44.6%
4
New York 7
Samuel R. Betts
Democratic-Republican
1814
Retired Democratic-Republican hold
Josiah Hasbrouck (DR) 51.7% John Sudam (F) 48.2%
5
New York 10
Hosea Moffitt
Federalist
1812
Retired Federalist hold
John P. Cushman (F) 54.9% Thomas Turner (DR) 44.9%
6
New York 11
John W. Taylor
Democratic-Republican
1812
Re-elected
John W. Taylor (DR) 53.4% Elisha Powell (F) 46.6%
7
New York 13
John B. Yates
Democratic-Republican
1814
Retired Democratic-Republican hold
Thomas Lawyer (DR) 54.9% William Beekman (F) 45.1%
8
New York 17
Westel Willoughby, Jr.
Federalist
1814
Retired Democratic-Republican gain
Thomas H. Hubbard (DR) 51.5% Simeon Ford (F) 48.4%
9
New York 18
Moss Kent
Federalist
1812
Retired Federalist hold
David A. Ogden (F) 50.4% Ela Collins (DR) 49.5%

Questions and formulas:
Question: how many times was the incumbent is john b. yates?
Formula: ROWS(UNIQUE(FILTER(C1, B1="John B. Yates")))
Formula2: ROWS(UNIQUE(FILTER(C2:C9, B2:B9="John B. Yates")))
Level: medium
Question: when was the first elected when the  candidates is thomas lawyer (dr) 54.9% william beekman (f) 45.1%?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:F1,F1="Thomas Lawyer (DR) 54.9% William Beekman (F) 45.1%"),4))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:F9,F2:F9="Thomas Lawyer (DR) 54.9% William Beekman (F) 45.1%"),4))
Level: medium
Question: who are the candidates for district new york 10?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:F1,A1="New York 10"),6))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:F9,A2:A9="New York 10"),6))
Level: medium
Question: how many times were the candidates thomas h. hubbard (dr) 51.5% simeon ford (f) 48.4%?
Formula: ROWS(UNIQUE(FILTER(C1, F1="Thomas H. Hubbard (DR) 51.5% Simeon Ford (F) 48.4%")))
Formula2: ROWS(UNIQUE(FILTER(C2:C9, F2:F9="Thomas H. Hubbard (DR) 51.5% Simeon Ford (F) 48.4%")))
Level: medium
Question: what is the district when the party is federalist and first elected is 1814?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:F1,(C1="Federalist")*(D1=1814)),1))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:F9,(C2:C9="Federalist")*(D2:D9=1814)),1))
Level: medium