This question already has an answer here:
I sold some fund shares with high turnover on my personal investment account with the intent of buying something similar later on my IRA account. However, after I sold (and within 30 days), I received dividends on the leftover shares which I have set to automatically invest into shares. Have I created a wash sale? I've seen questions asking with something similar, but I'm not sure if order matters between dividend and selling.
Presuming I have caused a wash sale: if I sold 100 shares, then got a 2 share "dividend" via reinvestment of my other shares, can I still use the 98 shares as a loss or is the entire transaction considered a wash sale?