How to correctly adjust qualified dividends and long term capital gains on line 1a of form 1116 when there is capital gains excess?

When there is more than $20,000 of foreign (including resourced) qualified dividends and long term capital gains (not over the 15% tax rate), I assume that typically in the most simplified scenario (with no US or foreign losses), the foreign source has to be adjusted in line 1a by removing the pro rated amount that was taxed at 0% (worldwide amount found on line 9 of Qualified Dividends and Capital Gain Tax Worksheet [QDCGTW]), and removing 62.12% of the pro rated amount that was taxed at 15% ( worldwide amount found on line 17 of QDCGTW). In line 18, the same reduction is applied to worldwide Q-div and L-cap-gain.

 

For line 1a, the pro rated amount is typically calculated by a fraction, with the numerator being the foreign source of Q-div and L-cap-gain for a category and column of 1116, and the denominator the worldwide source of Q-div and L-cap-gain.  The denominator is typically found on line 4 of QDCGTW, which is simply the sum of worldwide Q-div and L-cap-gain.

 

However, when the foreign earned income exclusion completely eliminates all earned income, and when there is very little ordinary income such as interest, the result is a large capital gains excess, which is simply the remaining standard deduction applied to Q-div and L-cap-gain, after first being applied to ordinary income. For the purpose of the Foreign Earned Income Exclusion Tax Worksheet (FEIETW), a second QDCGTW is filled out with line 4 reduced by the capital gain excess.

 

The problem is that I have seen examples and some tax software, when calculating the pro rata amount of Q-div and L-cap-gain at the 0% and 15% tax rates to be removed from line 1a of 1116, they use the the newly reduced line 4 as the denominator, instead of the worldwide Q-div and L-cap-gain before the reduction by capital gains excess.  What this effectively does is to double count the standard deduction on the foreign source Q-div and L-cap-gain, because line 3g of 1116 is already doing this. The result is very little foreign tax credit and still a large amount of double taxation, and some test inputs result in negative numbers for line 7 when 3g is greater than 1a (due to double reducing the standard deduction) which may break the form.

 

For the denominator of the pro rata fraction, is it correct to use the newly reduced line 4 in the QDCGTW, or before reduction by the capital gain excess?