Dr. Rank acts as a foil character to Torvald, in effect pointing to the failings of Torvald, especially in his role as a husband. He also provides information in the drama.
Dr. Rank's most important role is that of a foil character. He sheds light on the moral weakness of Torvald, for Dr. Rank's lack of concern about what others think of him accentuates Torvald's consuming anxiety about his reputation, a reputation that he values over his marriage and concern for Nora's feelings. And whereas Dr. Rank demonstrates consideration for the feelings of those he cares for, he also has a stoic acceptance of his fate, unlike Torvald. For instance, Torvald is nearly hysterical when his reputation is threatened by Nora's having forged her father's name on the loan she secured years ago. Clearly, Torvald worries more about his reputation than the fact that Nora's dangerous but loving act of securing the loan so that he could go to Italy and restore his health has saved him from death. Later, Torvald is extremely worried about public appearances and his business reputation, insisting upon maintaining them "at any costs," even to the point of losing his wife, Nora. On the other hand, Dr. Rank does not concern himself with public opinion.
Another instance of Dr. Rank's role as a foil is demonstrated as he retires to his room in order to die of his disease privately, but Krogstad displays his moral disease of corruption. This physical illness of Dr. Rank also serves to act as a counterpart to the moral disease of selfishness from which Krogstad suffers.
Further, Dr. Rank's genuine feeling, love, and respect for Nora contrast sharply with Torvald's patronizing treatment of his wife. Torvald talks to Nora as though she were a child and he disciplines her in a similar manner. Also, Torvald's opprobrium of Nora's loving actions, even though illegal, to save her husband's life is reduced to his selfish anxiety over her bringing disgrace to his name with this illegality.
In Act I Dr. Rank provides information as he warns Nora that Krogstad "suffers from a diseased moral character" and is "a moral invalid." Further, he advises Nora of Krogstad's past criminality and his actions as a blackmailer. Dr. Rank also serves to inform the audience about Torvald's superficiality. For example, in Act II, he remarks to Nora,
"Helmer's refined nature gives him an unconquerable disgust at everything that is ugly; I won't have him in my sick-room."
Dr. Rank's avoidance of exposing Torvald to anything that repels him serves to inform as well as to suggest that it may be Torvald who is truly the sheltered one in the Helmers' relationship, and not Nora.
In addition, Dr. Rank's close personal relationship with Nora, who often confides in him, points to the appreciation she has for his non-judgmental demeanor towards her. It also sheds light upon the fact that her relationship with her husband is lacking in many ways.
A character who is a foil and a provider of much information, Dr. Rank serves the author well in A Doll's House.