Using a NAME as a reference in another range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

* The value in cell A1 varies depending on the number of rows of data brought
down in a query
* I have used the 'NAME' function to name cell A1 '_DataRows'

I now want to use '_DataRows' to identify the end of a range in a SUMPRODUCT
formula. (i.e. a formula something like this...)

=SUMPRODUCT
(--($D$1:$D$"_DataRows"=XYZ),--($D$1:$D"_DataRows"<>""),--($E$1:$E"_DataRows"))


How do I do this (see examples below).

Many Thanks,

Craig

-------------------------------------------

Example 1:
---------------
If cell A1 = 25
Formula in cell B2: =SUMPRODUCT
(--($D$1:$D$25=XYZ),--($D$1:$D$25<>""),--($E$1:$E$25))


Example 2:
 
Change each portion to something like:
=sumproduct(--(INDIRECT("$D$1:$D$" & _datarows)=XYZ), ....


If you query would return 400 lines at most, why not just use $d$1:D$1000?

(choose a number that's big enough to never be exceeded--but don't use the whole
column)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top