Does a term you’re using need to be set apart from all other possibilities? If so, you must use a phrase or clause that acts as a restrictive modifier because the meaning of the term would be unclear without that restriction. No commas are used with restrictive clauses and phrases.
“The cells which had been incubated were counted.” (The implication is that there were other cells that were not counted; only the incubated cells were counted.) The clause “which had been incubated” restricts the information in that sentence to only certain cells. No commas are used because we need that restrictive clause to define which cells are being discussed.
“The cells, which had been incubated, were counted.” (The implication is that researchers were working with only one set of cells, and the clause “which had been incubated” describes a step in a process that involved all those cells.
Think of a nonrestrictive clause as adding information to a sentence that would have been complete without that extra information. (Had that clause been left out of the sentence, it would still be clear that the cells in the experiment were counted.) Because that clause can be left out, it is set apart with commas on either side.
“Which” and “that”:
Notice that the word “which” is used in both of these examples. A restrictive clause may be introduced by either “that” or “which,” so it would have been correct to say “The cells that had been incubated…” A nonrestrictive clause, on the other hand, must be introduced with “which” and not with “that.”
When it comes to clauses, the little comma becomes a big tool for clarifying meaning. To restrict your subject or not to restrict? It’s a “comma question”!