I can see the term "stack up" is used with different prepositions or without a preposition:
to stack up against
to stack up with
to stack up (compared)
So what differences in meaning do they convey when we use them with different prepositions?
Here are some examples:
1. When China reported real growth of 7% year-on-year in the first quarter, economists noted that this did not stack up with its nominal growth of 5.8%.
2. I think if you look at our competition there’s no way that people can really stack up with our exclusive content, and that’s an amazing part of what we’re doing at Xbox.
3. Teachers will know how they stack up against national standards.
4. Find out how your income stacks up compared to the rest of the world.
My questions are:
1. Can we replace the word with with the word against in examples 1 and 2? Would the meaning of the sentence change if we do?
2. Can we replace the word against with the word with in example 3? Would the meaning of the sentence change if we do?
3. Can we replace the word compare with against or with in example 4 without changing the sentence's meaning?
4. In example 1, could "to stack up" have been used in the sense of "to make sense" as in the following sentence? For me I can replace it more with "consistency, correspondence, or coherent.
Sorry but what you said just doesn't stack up with the odds.
Christine Ammer, The Random House Dictionary of American Idioms (1997) has this entry for stack up:
stack up 1. Measure up, equal, as in Their gift doesn't stack up against mine. This usage alludes to piling one's chips at poker, and comparing them to those of the other players. {Early 1900s} 2. Make sense, seem plausible, as in Her explanation just doesn't stack up. Also see ADD UP, def. 2 ["Be consistent, make sense"].
Ammer's distinction, which I think is valid, suggests that when stack up is being used in the poker chips sense, it is likely to take against as its following preposition. On the other hand, if stack up is being used in the sense of "add up" or "make sense," it may not need to take any preposition at all.
It seems to me that the OP's example 1—"When China reported real growth of 7% year-on-year in the first quarter, economists noted that this did not stack up with its nominal growth of 5.8%."—is the only one of the four where stack up means "make sense." It also seems to me that with could be replaced with given immediately after "stack up" without altering the sense of the sentence:
When China reported real growth of 7% year-on-year in the first quarter, economists noted that this did not stack up, given its nominal growth of 5.8%.
The other three examples use stack up in the poker chip sense of the phrase. I've already said that "stack up against" is a common wording to use in such situations, so that takes care of example 3. Example 4 is a bit wordier, but "stacks up compared to" seems perfectly reasonable as well.
That leaves example 2 as a bit of an oddball, in my opinion. I think the sentence sounds as though it came from some marketer's extemporaneous speech promoting a product, and as such it is loose in both construction and word choice. If I were preparing the sentence for publication, I would probably restate it along these lines:
Our exclusive content is an amazing part of what we’re doing at Xbox, and our competitors' offerings can't match it.
If you put "stack up with" in place of "match" in the revised wording, you'll see how awkward it is; it just doesn't belong there—and neither does "stack up against," really, although (to me) that phrase sounds somewhat better than "stack up with."
Here are my answers to the OP's four questions:
1. Can we replace the word with with the word against in examples 1 and 2? Would the meaning of the sentence change if we do?
In example 1, replacing with with against doesn't make much sense because, as noted above, with has essentially the same meaning as "given"; the phrase stack up in this first example has the meaning "add up" or "make sense," not "compare to" or "match up against" (which is the central meaning of "stack up against"). In example 2, replacing with with against marginally improves the sentence, because the speaker intends to use stack up in the sense of a comparison, but the sentence is very poorly worded in any case.
2. Can we replace the word against with the word with in example 3? Would the meaning of the sentence change if we do?
I can't say that using with in place of against in example 3 is absolutely idiomatically wrong; but it makes the sense of the sentence less clear to me, so I definitely wouldn't use with there. I would change the wording of this sentence to make explicit what the comparison involving teachers is about: "Teachers will know how their students' achievement stacks up against national standards of achievement [presumably based on standardized-test scores]."
3. Can we replace the word compare with against or with in example 4 without changing the sentence's meaning?
You can certainly replace compared to with against in example 4 and not alter the meaning significantly. Technically I would want to complete the comparison by saying something like "Find out how your income stacks up against incomes in the rest of the world"—but I would want to complete the comparison similarly if I stayed with the "compared to" wording. I would not used "stacks up with incomes in the rest of the world." Again, the wording isn't incomprehensible, but it seems (to me) less precise than either "compares to" or "stacks up against."
4. In the first example, could "to stack up" have been used in the sense of "to make sense," as in the sentence "Sorry but what you said just doesn't stack up with the odds"? For me I can replace it more with consistency, correspondence, or coherent.
I'm no sure what the final sentence of this question means, but the answer to the question posed in the first sentence of the question is yes it certainly could have been (and in fact was) used in the sense of "make sense." It could not, however, have been used in the sense of "compare like stacks of poker chips," unless the last part of the sentence were changed to make that meaning of stack up work properly. For example, you might rework the sentence as follows:
When China reported first-quarter year-on-year real growth of 7%, economists noted that this figure did not properly stack up against the corresponding number for nominal growth of 5.8%.
But instead of reworking the sentence in example 1 to shift from Ammer's definition 2 of stack up to Ammer's definition 1 of the same term, you're better off structuring the sentence in a way that supports the natural sense of the phrase in the context where it appears—and here the natural sense of the phrase is "makes sense" or "adds up."