How can Troi outrank Data?

In the 7th TNG season episode 16 Thine Own Self, Deanna Troi gets promoted to the rank of Commander after passing the "bridge test".

When Data hears of this, Troi tells him he can now call her "sir", implying that she now outranks him. How could that be true if they are both commanders (equal rank), and Data is third in command after Picard and Riker?

Because Data was of a lower rank!

Data was a Lieutenant Commander and Troi was promoted to Commander. Simply put, the ranking of Commander outranks Lieutenant Commander. Data was speaking technically that Troi outranked him - because Troi was a Commander, a higher rank, she could give him an order.

You are getting confused with the chain of command on the ship - Data was third in command (second officer) as pointed out in the question. What this means is that should both Picard and Riker be unavailable, Data is next in line to take command of the ship and becomes an 'acting' Captain, which would then outrank Troi.

The important point to take away from this answer is that there is a difference between chain of command 'rank' and actual 'rank'

The chain of command refers to the order when the captain is absent of who will assume the captain's role. On the Enterprise-D this goes:

1. Picard
2. Riker
3. Data

So, if Picard and Riker are absent, Data essentially assumes the role of Captain.

In terms of real rank though, on the Enterprise-D we have

1. Captain
2. Commander (this is where Troi sits)
3. Lt Commander (this is where Data sits)

So, when Data assumes the captain's role, he jumps to position 1 on the chain of command and therefore also on the ranking. I hope this makes sense!

• Ah. i was sure data has the rank of commander, not lieutenant commander. That explains everything.
– 5xum
Commented Aug 9, 2015 at 7:52
• @Lohoris it's simple - an officer's role on the ship was dictated by both their rank and their qualifications/experience. The captain decides the command structure, so selects the officers that best qualify them for specific roles (First Officer, Second Officer, etc). Not stated in canon, Dr Crusher probably held the rank of Commander longer than Riker (based on age), so she technically out ranked him. But you wouldn't want Dr Crusher to command the ship if the Captain was gone, so the Captain picked Riker to be 2nd in command. Commented Aug 9, 2015 at 10:20
• To use US military terminology, it's the difference between rank and billet, in the sense of a specific personnel position, assignment, or duty station. Lieutenant Commander is a rank, Second Officer is a billet. Dr. Crusher's billet allows her to give medical orders to the Captain, even though he outranks her. Likewise, Data's billet, not his rank, is what would allow him to give orders to everyone else on the ship if the Captain and First Officer were incapacitated. Commented Aug 9, 2015 at 22:13
• Commented Aug 10, 2015 at 0:46
• In Firefly parlance: "You know what the chain of command is? It's the chain I go get and beat you with until you understand who's in ruttin' command here." (Not that Data would express it in exactly those terms...) Commented Aug 10, 2015 at 8:11

Rank does not equal command. Two lieutenants could be serving under different colonels and thus be parts of different chains of command. Beverly Crusher (ranked Commander) once relieved a captain of duty for medical reasons. If, as a counselor, Troi is part of medical command hierarchy, she would only be in charge when all commander-level officers are not available to take charge.

In the real world navy, officers may hold the rank of Lt. Commander, Commander or even be captains and admirals without ever being in command of a ship. Troi and Crusher are a psychiatrist and a physician, respectively. They'd be what are called staff officers, which means they are not in direct chain of command. Data has obviously passed the same "bridge officer's test" Troi took but is still a Lt. Commander. Additionally in the climax of ST-Nemesis, we see Data in command since Picard and Riker are both off the bridge. He turns command over to Troi we he too, must leave. It's all a product of poor research and bad writing.