can i exclude capital improvements upon sale of a house that is not my primary residence

There is a 500k$ exclusion to capital gains on our primary residence. Can we also exclude capital improvements? If so, is there a limit to the capital improvement exclusion? 

What about a house that is NOT our primary residence. I know there is no basic exclusion but can we exclude capital improvements?