Even the boldest, most confident writers can cower in fear and sob with frustration when confronted with the problem of whether to use who or whom in a sentence. Heck, I know it confuses me.
Here’s the distinction: Use who to refer to the subject of the sentence (“I am the person who you are looking for”) and whom to refer to the object of the sentence (“Whom have you invited?”)
If you’re still unsure about which form to use in a sentence, try this test: Restate the sentence with a personal pronoun, or, if it is a question, answer the question with one word. If the personal pronoun in the restatement or response is he or she, who is correct. If it’s him or her, whom is correct.
Statement: “I have a friend who can help.”
Restatement: “He can help.” (Who is correct.)
Question: “Whom have you invited?”
Response: “Him.” (Whom is correct.)
Note, however, that sometimes you can avoid the problem of determining which form to use by omitting a relative pronoun altogether, and the result is often an improvement. For example, the sentence “I am the person who you are looking for” is better rendered as “I am the person you are looking for.”
Also, beware of these pitfalls: “They’ll complain to whoever [not whomever] will listen” is correct, because whoever is the subject of “will listen.” However, “Whomever [not whoever] you hire is fine with me” is correct because whomever is the object of hire.
Furthermore, use of whom in a sentence such as “It was Smith and Jones whom we had to contend with” is a hypercorrection. (“It was Smith and Jones who we had to contend with” is correct, though the sentence is better with the pronoun omitted: “It was Smith and Jones we had to contend with.”) Append a phrase containing the same pronoun to realize how awkward this form is. (“It was Smith and Jones whom we had to contend with, whom some among us feared.”)
These complications, and others, make traditional rules regarding use of whom problematic; when even experienced writers have to repeatedly pore through a grammar text to remind themselves about the details, the distinction has ceased to be practical. The fusty who/whom distinction is fading in conversational usage, and it is my fervent hope that the use of whom except in unambiguous “to whom” constructions will likewise atrophy.
I’ll let legendary language maven William Safire have the last word: Of this issue, he said, in effect, when the question of whether to use whom or who arises, revise the sentence so that you don’t have to puzzle over which form is correct.