Autofill changes formulas strangely

nfshp253

New Member
Joined
Jul 24, 2017
Messages
9
I have this formula at cell E2:

=RIGHT($D2&"-"&COUNTIF($D$2:$D2,$D2),LEN($D2&"-"&COUNTIF($D$2:$D2,$D2))-FIND("-",$D2&"-"&COUNTIF($D$2:$D2,$D2),FIND("-",$D2&"-"&COUNTIF($D$2:$D2,$D2))+1))

This is to find the instance/occurrence of the value at D2 counting from above, but not below it.

Logically to me, when Excel autofills, the formula at E3 shoud be:

[QUOTE}=RIGHT($D2&"-"&COUNTIF($D$2:$D3,$D3),LEN($D2&"-"&COUNTIF($D$2:$D3,$D3))-FIND("-",$D3&"-"&COUNTIF($D$2:$D3,$D3),FIND("-",$D2&"-"&COUNTIF($D$2:$D3,$D3))+1))[/QUOTE]

But instead, when autofilling, the first formula changes to this:
=RIGHT($D2&"-"&COUNTIF($D$2:$D8,$D2),LEN($D2&"-"&COUNTIF($D$2:$D8,$D2))-FIND("-",$D2&"-"&COUNTIF($D$2:$D8,$D2),FIND("-",$D2&"-"&COUNTIF($D$2:$D8,$D2))+1))

The fourth formula becomes this:
=RIGHT($D5&"-"&COUNTIF($D$2:$D8,$D5),LEN($D5&"-"&COUNTIF($D$2:$D8,$D5))-FIND("-",$D5&"-"&COUNTIF($D$2:$D8,$D5),FIND("-",$D5&"-"&COUNTIF($D$2:$D8,$D5))+1))

And even worse, the fifth formula becomes this:
=RIGHT($D6&"-"&COUNTIF($D$2:$D11,$D6),LEN($D6&"-"&COUNTIF($D$2:$D11,$D6))-FIND("-",$D6&"-"&COUNTIF($D$2:$D11,$D6),FIND("-",$D6&"-"&COUNTIF($D$2:$D11,$D6))+1))

Why is this happening? Why is the array not expanding step-by-step? And why would the first formula change on its own? The data comes with headers and are formatted as a table.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top