Table:
0
A
B
C
D
E
1
Name
Entered office
Left office
Party
First Minister
2
Name
Entered office
Left office
Party
First Minister
3
Angus MacKay
19 May 1999
2 November 2000
Labour
Donald Dewar
4
Iain Gray
2 November 2000
28 November 2001
Labour
Henry McLeish
5
Richard Simpson
28 November 2001
26 November 2002
Labour
Jack McConnell
6
Hugh Henry
28 November 2002
14 November 2006
Labour
Jack McConnell
7
Johann Lamont
16 November 2006
17 May 2007
Labour
Jack McConnell
8
Minister for Community Safety
Minister for Community Safety
Minister for Community Safety
Minister for Community Safety
Minister for Community Safety
9
Fergus Ewing
17 May 2007
20 May 2011
Scottish National Party
Alex Salmond
10
Minister for Community Safety and Legal Affairs
Minister for Community Safety and Legal Affairs
Minister for Community Safety and Legal Affairs
Minister for Community Safety and Legal Affairs
Minister for Community Safety and Legal Affairs
11
Roseanna Cunningham
20 May 2011
Incumbent
Scottish National Party
Alex Salmond

Questions and formulas:
Question: When did first minister Henry Mcleish enter office?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:E1,E1="henry mcleish"),2))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:E11,E2:E11="henry mcleish"),2))
Level: medium
Question: What is the name of the minister that left office on 14 November 2006?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:E1,C1="14 november 2006"),1))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:E11,C2:C11="14 november 2006"),1))
Level: medium
Question: What is the name of the minister from the party of minister for community safety and legal affairs?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:E1,D1="minister for community safety and legal affairs"),1))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:E11,D2:D11="minister for community safety and legal affairs"),1))
Level: medium
Question: What is the name of the minister who has an entered office of entered office?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:E1,B1="entered office"),1))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:E11,B2:B11="entered office"),1))
Level: medium
Question: What is the party of the minister who left office on 26 November 2002?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:E1,C1="26 november 2002"),4))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:E11,C2:C11="26 november 2002"),4))
Level: medium
Question: What is the party of Richard Simpson?
Formula: UNIQUE(CHOOSECOLS(FILTER(A1:E1,A1="richard simpson"),4))
Formula2: UNIQUE(CHOOSECOLS(FILTER(A2:E11,A2:A11="richard simpson"),4))
Level: medium