After service in HMA Ships Brisbane and Melbourne, Sub Lieutenant Rankin was posted to the United Kingdom for service in a number of Royal Navy Ships. He attended the Junior Officers' War Course and was promoted to Lieutenant in 1929, specialising in surveying
When World War II broke out he was serving as a Lieutenant Commander in the minesweeper HMS Gleaner, but was posted soon after to the repair ship HMS Resource as First Lieutenant. He returned to Australia in 1941 and was appointed in command of the sloop HMAS Yarra in January 1942.
On 4 March 1942, while escorting a small convoy to Australia, Yarra was attacked by a Japanese force of three cruisers and two destroyers and the convoy was overwhelmed. Yarra fought to the very last and Lieutenant Commander Rankin was killed by a salvo of shells which struck the bridge shortly after he had given the order to abandon ship