Table:
0
A
B
C
D
E
F
1
District
Incumbent
Party
First elected
Result
Candidates
2
Pennsylvania 6
Mathias Morris
Anti-Jacksonian
1834
Re-elected
Mathias Morris (W) 51.4% John Rockman (D) 48.6%
3
Pennsylvania 10
William Clark
Anti-Masonic
1832
Retired Democratic gain
Luther Reily (D) 50.8% George W. Harris (W) 49.2%
4
Pennsylvania 11
Henry Logan
Jacksonian
1834
Re-elected
Henry Logan (D) 58.2% Jacob Kirk (W) 41.8%
5
Pennsylvania 13
Jesse Miller
Jacksonian
1832
Retired Democratic hold
Charles McClure (D) 57.5% William Sharon (W) 42.5%
6
Pennsylvania 15
Andrew Beaumont
Jacksonian
1832
Retired Democratic hold
David Petrikin (D) 52.1% John McReynolds (W) 47.9%
7
Pennsylvania 18
Job Mann
Jacksonian
1832
Lost re-election Anti-Masonic gain
Charles Ogle (AM) 51.7% Job Mann (D) 48.3%
8
Pennsylvania 20
Andrew Buchanan
Jacksonian
1832
Re-elected
Andrew Buchanan (D) 100%

Questions and formulas:
Question: How many times did the incumbent was first elected and then lost re-election anti-masonic gain?
Formula: SUMIFS(D1,E1,"Lost re-election Anti-Masonic gain")
Formula2: SUMIFS(D2:D8,E2:E8,"Lost re-election Anti-Masonic gain")
Level: easy
Question: Who were the candidates if the incumbent was Henry Logan?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:F1,B1="Henry Logan"),6))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:F8,B2:B8="Henry Logan"),6))
Level: medium
Question: What was the district of the incumbent Mathias Morris?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:F1,B1="Mathias Morris"),1))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:F8,B2:B8="Mathias Morris"),1))
Level: medium
Question: How many incumbents was first elected in the Anti-Masonic party?
Formula: SUMIFS(D1,C1,"Anti-Masonic")
Formula2: SUMIFS(D2:D8,C2:C8,"Anti-Masonic")
Level: easy