'How to convert google formula to excel?

Please help me convert simple formula for auto increment with condition - =Arrayformula(if(D2:D="",,countifs(D2:D, D2:D, row(D2:D), "<="&row(D2:D))))

I've tried to use the following, but it doesn't work:

{=if(D2:D2000="","",countifs(D2:D2000, D2:D2000, row(D2:D2000), "<="&row(D2:D2000)))}

I get the error "There's a problem with this formula".

Here is the expected result (column E)

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source