Residence requirement for selling house

I have lived in my house for about ten years, but my wife has only lived in my house for one year.  Will we be able to avoid tax up to 500k when selling a house?  

What if we have been married for two years (marriage certificate is two years old), but my wife has only lived in my house for one year, will we be able to avoid tax up to 500k when selling a house?   Thank you.