I will give a somewhat different answer from JoeTaxpayer's answer, though I fully agree with his first sentence.
What is it you want to do?
Sell a fixed number, say 100, shares
of a mutual fund regardless of the price?
Sell enough shares to
raise $1000 cash?
Or sell your entire investment in the mutual
fund because you just want out?
In the days leading up to a distribution from a
mutual fund (which, by the way, is announced
ahead of time together with an estimated amount
of the distribution), the price of shares in the
fund includes the value of the distribution.
Suppose that it is a long-term capital gain
distribution.
Some share holders will have told the fund that
they will take the distribution as cash, others
that they will reinvest in the fund, and so the
fund will be holding some cash to pay out to
folks taking the distribution as cash. Suppose
the fund has announced that it will be distributing
a $1 dividend per share, and the current share
price is $11. Immediately after the distribution,
the share price will be $10. If you hold 500 shares
and opted to take cash, you will get a check for $500,
and of course you will continue to hold the same 500
shares which are now worth only $10 each. But no
change in wealth: you had $5500 invested in 500 shares
before the distribution, and you have $5000 invested in
the same 500 shares and $500 cash.
If you opted to reinvest, you will be sold 50 shares
($500 divided by new share price of $10) and now be the
proud owner of 550 shares valued at $10 per share.
So, before the distribution, you had $5500 invested
in 500 shares in the fund; afterwards you have $5500
invested in 550 shares at $10 each, that is, no
change in wealth. And in either case, you have
$500 taxable long-term capital gain.
So, if you want to sell 100 shares, you will get
$1100 before the distribution, but only $1000 afterwards.
Whether you have a capital gain or loss resulting
from the sale depends on
which shares you choose to sell and at what
price you bought them.
If you want to raise $1000, you will need to sell
fewer shares before the distribution and more
afterwards (unless you took the distribution as
cash and are counting it towards the
$1000 to be raised). Again, capital gain or loss from the
sale depends on
which shares you choose to sell and at what
price you bought them.
If you want out completely, you will get $5500 either
way, before the distribution or afterwards. If you
bought all 500 shares for $10 each, then you will
have a long-term capital gain of $500 upon selling
them for $11 each just before the distribution. You will get a
Form 1099-B from the fund and report this gain
on Schedule D. Selling the
550 shares right after the distribution (or taking
the distribution in cash and selling the 500 shares
after the distribution) will give you no capital gain
from the sale but you will have a $500 long-term
capital gain from the distribution that will be
reported on a Form 1099-DIV and will also be
reported on Schedule D on a different line (but be
taxable nonetheless). On the other hand, if you
had bought the shares for $11 each, then there is
no capital gain if you sell before the distribution,
while if you sell after the distribution (at $10
per share), then you have a capital loss of $500
on the sale which will cancel out the capital
gain from the distribution, that is, no gain
or loss regardless of which choice you make:
sell before the distribution or after. Have fun
working out what happens in you bought those
shares in dribs and drabs and at different
prices over the years.