LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 829
Default Using SUM(INDIRECT())

Errata.... I wrote:
All of these formulas make the same assumption, to wit:
G1000="Head", and the formula is copied down no further
than row 999. Otherwise, SMALL returns a #NUM error,
and the MIN formula returns an incorrectg result.


The MIN formula returns an incorrect result if G1000="Head" and the formula
is copied down through row 1000. Otherwise, the MIN formula returns a
#VALUE error.


I wrote:
=IF(G3="Head",SUM(F3:INDEX(F:F,
MIN(IF(G4:$G$1000="Head",ROW(G4:$G$1000)))-1)),"")


If is probably not a good idea to reference G4 because of Excel's treatment
of G4:$G$1000 if the formula is copied down through row 1000.


I wrote:
If that assumption is incorrect, here is one way to
correct the formulas (again, array-entered):

=IF(G3="Head",IF(ROW(G3)=ROW($G$1000),F3,
SUM(F3:INDEX(F:F,SMALL(IF($G$2:$G$1000="Head",
ROW($G$2:$G$1000)),COUNTIF($G$2:G3,"Head")+1)-1))),"")


Hogwash!

If you cannot abide by the assumptions above, try one of the following
(remember: array-entered by pressing ctrl+shift+Enter instead of just
Enter).

(Also note the simplification of the SMALL expression.)

For Excel 2007 and later:

=IF(G3="Head",IFERROR(SUM(F3:INDEX(F:F,
SMALL(IF(G3:$G$1000="Head",ROW(G3:$G$1000)),2)-1)),
SUM(F3:$F$1000)),"")

For Excel 2003 and earlier:

=IF(G3="Head",IF(COUNTIF(G3:$G$1000,"head")1,
SUM(F3:INDEX(F:F,
SMALL(IF(G3:$G$1000="Head",ROW(G3:$G$1000)),2)-1)),
SUM(F3:$F$1000)),"")

 
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
Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions Mike Barlow Excel Worksheet Functions 7 May 21st 23 07:42 PM
Help with INDIRECT Anita Taylor Excel Worksheet Functions 5 March 6th 08 12:50 AM
INDEX("a"&COLUMNS(INDIRECT(A1):INDIRECT(A2)):A30,4) Dave F[_2_] Excel Discussion (Misc queries) 3 September 20th 07 08:36 PM
Indirect? moose0507 Excel Worksheet Functions 1 March 2nd 06 04:29 PM
indirect using name tocguy Excel Worksheet Functions 2 February 24th 06 06:57 AM


All times are GMT +1. The time now is 02:30 AM.

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"