I’ll answer two questions at the same time. Do you use that or which? Do you need commas with that and which?
To answer both questions, you need to understand restrictive and non-restrictive phrases and clauses. Here are the answers in brief.
1. Use which and commas with non-restrictive phrases and clauses.
2. Use that and no commas with restrictive phrases and clauses.
Now, let find out why.
Restrictive phrases and clauses: A restrictive phrase or clause points out which thing you are writing about.
Let’s say you have four filing cabinets in your office and that all but one cabinet is locked. The unlocked cabinet is the one next to the window. You need someone to come and lock the cabinet because you don’t have a key.
You decide to send an e-mail to the maintenance office. You need to tell the maintenance officer which cabinet is unlocked. You correctly write this statement:
“Please come to my office as soon as possible and lock the cabinet that is next to the window.” (The restrictive phrase is underlined.)
By using the word that, you point out which cabinet of several is unlocked. You indicate that your office has more than one cabinet but that the one you are referring to is by the window. You have limited, or restricted, the maintenance officer’s attention from many cabinets to one cabinet. Of all the cabinets, you mean that one.
This information is essential for the reader, the maintenance officer, to know which cabinet to lock. Because it is essential information to know which cabinet, you don’t want to separate it from cabinet. As such, you don’t use commas.
As you can see from this example, a restrictive phrase or clause indicates which thing you mean. Also, a restrictive clause is not separated from the thing is describes by commas.
Non-restrictive phrases and clauses: A non-restrictive phrase or clause provides an unnecessary and generally off-topic description of something.
In this case, let’s say you move to a new office and you have only one filing cabinet. This cabinet is next to the door. To your surprise, the cabinet is locked, and you don’t have the key. Again, you send an e-mail to the maintenance officer. You correctly write this statement:
“Please come to my office as soon as possible and unlock the cabinet, which is next to the door.” (The non-restrictive phrase is underlined.)
By using the word which, you provide a description of the cabinet. You indicate that you have only one cabinet and that it is next to the door. Because you have only one cabinet, you do not need to restrict the reader’s attention from multiple cabinets to one. You are not telling the reader that one. Rather, you are providing a description of the single cabinet.
Although the description might help the maintenance officer find the cabinet, the description does not point out the locked cabinet from other cabinets because you have only one cabinet. This is why the phrase “which is next to the door” is non-restrictive.
As you can see from this example, a non-restrictive phrase or clause does not indicate which thing you mean. Also, a non-restrictive phrase is separated from the rest of the sentence with commas.
Why this matters: Choosing to use a restrictive or non-restrictive phrase or clause can change the meaning of the sentence. For example, these two sentences mean different things.
“Take the book, which I put on the table.” (This sentence indicates that you have only one book. The non-restrictive clause provides a description of the book.)
“Take the book that I put on the table.” (This sentence indicates that you have more than one book. The restrictive clause provides necessary information to tell the reader which book to take.)
In regard to the title of this article, use commas with which when you write a non-restrictive phrase or clause. Don’t use a comma with that when you write a restrictive phrase or clause.