Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
cdavidson
 
Posts: n/a
Default Using a NAME as a reference in another range

* 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:
---------------
If cell A1 = 38
Formula in cell B2: =SUMPRODUCT
(--($D$1:$D$38=XYZ),--($D$1:$D$38<""),--($E$1:$E$38))




  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default Using a NAME as a reference in another range

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)






cdavidson wrote:

* 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:
---------------
If cell A1 = 38
Formula in cell B2: =SUMPRODUCT
(--($D$1:$D$38=XYZ),--($D$1:$D$38<""),--($E$1:$E$38))


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Match function...random search? Les Excel Worksheet Functions 10 July 28th 05 11:54 AM
How to Select a relative range with Using "Find" and Offset() Dennis Excel Discussion (Misc queries) 7 July 27th 05 03:57 PM
Offset Function works in cell, not in named range DragonslayerApps Excel Worksheet Functions 0 July 25th 05 04:39 PM
Reference the worksheet from a multiple worksheet range function ( DBickel Excel Worksheet Functions 1 May 28th 05 03:49 AM
How do I reference and sort a range of numbers in Excel 97? Old Northern Excel Worksheet Functions 3 December 14th 04 03:15 PM


All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"