Separate the coins into 3 stacks of 9 (A, B, C).
Weigh stack A against B and then A against C.
Take the stack with the different weight (note lighter or heavier) and break it into 3 stacks of 3 (D, E, F).
Weigh stack D against E. If D and E are equal, then F is the odd stack. If D and E are not equal, the lighter or heavier (based on the A, B, C comparison) is the odd stack.
You now have three coins (G, H, I).
Weigh G and H. If G equals H, then I is the odd and is lighter or heavier (based on the A, B, C comparison).
If G and H are not equal, then the lighter or heavier (based on the A, B, C comparison) is the odd coin.