A yard of cotton, a yard of wool, and a yard of silk will weigh different amounts, even if they knit up exactly the same. You'll have to look at the gauge of the yarn (how many stitches per inch). Here's what you do, assuming you have two yarns that knit at the same gauge (yarn X is the yarn the pattern calls for, and yarn Y is the yarn you want to substitute):
1. Find how many skeins/hanks/balls/whatever X the pattern calls for in the size you want.
2. Multiply this number by the number of yards per skein X.
3. Divide this number by the number of yards per skein Y.
4. Round up to the nearest whole number to see how many skeins/hanks/balls/whatever of Y you'll need to buy (because you can't buy a partial ball of yarn, although it would be helpful sometimes).
For example, if you were to make this
cardigan in the yarn shown, size Small, it would take 6 balls of WoolEase. Let's say you wanted to make it in Lion Wool instead, which gets the same gauge according to the manufacturer. Here's what you would do:
1. This cardigan calls for 6 balls of WoolEase.
2. Each ball of WoolEase contains 197 yards of yarn (in the solid colors). So, 6 x 197 is 1182 yards. This is the total amount of yarn you'll need.
3. Each ball of Lion Wool contains 158 yards. So, 1182 / 158= 7.48
4. Rounding this number up gives you 8 balls of Lion Wool.
I hope this helps!