Use of charitable donation in excess of IRA RMD

I donated to a charity directly from my IRA which is in excess of the IRA RMD.  I also had a RMD from my 401K.  Can I use the excess from my IRA donation to offset the tax for my 410K rmd?