Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Attempted to make equation with maxIF dynamic however end up with errors (in excel)

I have an equation that references a dynamic dataset… When referencing these dynamic columns I initially just used the range row 3 to row 2000 (as this range is a lot longer than my actual dataset). Unfortunately when I refresh the data it changes this range and messes up the whole equation… So I attempted to make it dynamic.

The initial equation I wrote (ie referencing row 3 to row 2000) as follows.

=IF(MAXIFS($EA$3:$EA$2000,Book1!$C$3:$C$2000,Book1[@[project_id]])=Book2!EA3,MAXIFS($EA$3:$EA$2000,Book1!$C$3:$C$2000,Book1[@[project_id]]),0)

This is my attempt at making it dynamic (so I don’t need to keep on fiddling around with the equation):

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

=IF(MAXIFS($EA$3:INDEX($EA$3:$EA$2000,COUNTA($EA$3:$EA$2000)),Book1!$C$3:INDEX($C$3:$C$2000,COUNTA($C$3:$C$2000)),Book1[@[project_id]])=Book2!EA3,MAXIFS($EA$3:INDEX($EA$3:$EA$2000,COUNTA($EA$3:$EA$2000)),Book1!$C$3:INDEX($C$3:$C$2000,COUNTA($C$3:$C$2000)),Book1[@[project_id]]),0)

But I get a #VALUE error and unsure how to resolve this.

>Solution :

The ranges passed to MAXIFS must be of an equal size, which means that COUNTA($C$3:$C$2000) and COUNTA($EA$3:$EA$2000) must be equal, which I suspect they are not (you can easily verify).

You are correct to attempt to restrict your ranges, as this in general is good practice: some functions, however, including MAXIFS, employ implicit detection of the last-used cells within the ranges passed, effectively meaning that you can get away with referencing entire columns with no detriment to calculation performance. As such, that would be my recommendation to you, i.e. use $EA:$EA in place of $EA$3:$EA$2000, etc.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading