#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 34
Default DSUM criteria

Is there a way to assign the criteria for DSUM (or a similar funciton)
without giving a range cells but a string literal or formula? I came
up with something that works a little bit but is still having
problems:

A | B |
C | D
1 | tree | height | sum by type |
criteria
2 | apple | 1 | =DSUM(A$1:B$5,"height",D1:D2) |
=tree=INDIRECT("A2")
3 | pear | 2 | =DSUM(A$1:B$5,"height",D2:D3) |
=tree=INDIRECT("A3")
4 | apple | 3 | =DSUM(A$1:B$5,"height",D3:D4) |
=tree=INDIRECT("A4")
5 | fig | 4 | =DSUM(A$1:B$5,"height",D4:D5) |
=tree=INDIRECT("A5")

result:
A | B |
C | D
1 | tree | height | sum by type |
criteria
2 | apple | 1 |
5 | #NAME?
3 | pear | 2 |
2 | #NAME?
4 | apple | 3 |
5 | #NAME?
5 | fig | 4 |
8 | #NAME?

This does what I want (sums tree heights by type in column D) but has
the problem that I cannot simply copy and paste the formula in D2 to
successive rows without manually changing the "A2" to "A3", etc.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,886
Default DSUM criteria

Hi Edward

Try using
tree=INDIRECT("A"&ROW(A2))
That will resolve to INDIRECT(A2) and change as you copy down to A3, A4
etc.

--
Regards

Roger Govier


"Edward" wrote in message
ps.com...
Is there a way to assign the criteria for DSUM (or a similar funciton)
without giving a range cells but a string literal or formula? I came
up with something that works a little bit but is still having
problems:

A | B |
C | D
1 | tree | height | sum by type |
criteria
2 | apple | 1 | =DSUM(A$1:B$5,"height",D1:D2) |
=tree=INDIRECT("A2")
3 | pear | 2 | =DSUM(A$1:B$5,"height",D2:D3) |
=tree=INDIRECT("A3")
4 | apple | 3 | =DSUM(A$1:B$5,"height",D3:D4) |
=tree=INDIRECT("A4")
5 | fig | 4 | =DSUM(A$1:B$5,"height",D4:D5) |
=tree=INDIRECT("A5")

result:
A | B |
C | D
1 | tree | height | sum by type |
criteria
2 | apple | 1 |
5 | #NAME?
3 | pear | 2 |
2 | #NAME?
4 | apple | 3 |
5 | #NAME?
5 | fig | 4 |
8 | #NAME?

This does what I want (sums tree heights by type in column D) but has
the problem that I cannot simply copy and paste the formula in D2 to
successive rows without manually changing the "A2" to "A3", etc.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 34
Default DSUM criteria

This resolves the A3, A4 problem but now the formula does not work. I
get the same result if I leave out the INDIRECT and just go with
tree=A2.

On Jul 9, 10:13 am, "Roger Govier"
wrote:
Hi Edward

Try using
tree=INDIRECT("A"&ROW(A2))
That will resolve to INDIRECT(A2) and change as you copy down to A3, A4
etc.

--
Regards

Roger Govier

"Edward" wrote in message

ps.com...



Is there a way to assign the criteria for DSUM (or a similar funciton)
without giving a range cells but a string literal or formula? I came
up with something that works a little bit but is still having
problems:


A | B |
C | D
1 | tree | height | sum by type |
criteria
2 | apple | 1 | =DSUM(A$1:B$5,"height",D1:D2) |
=tree=INDIRECT("A2")
3 | pear | 2 | =DSUM(A$1:B$5,"height",D2:D3) |
=tree=INDIRECT("A3")
4 | apple | 3 | =DSUM(A$1:B$5,"height",D3:D4) |
=tree=INDIRECT("A4")
5 | fig | 4 | =DSUM(A$1:B$5,"height",D4:D5) |
=tree=INDIRECT("A5")


result:
A | B |
C | D
1 | tree | height | sum by type |
criteria
2 | apple | 1 |
5 | #NAME?
3 | pear | 2 |
2 | #NAME?
4 | apple | 3 |
5 | #NAME?
5 | fig | 4 |
8 | #NAME?


This does what I want (sums tree heights by type in column D) but has
the problem that I cannot simply copy and paste the formula in D2 to
successive rows without manually changing the "A2" to "A3", etc.- Hide quoted text -


- Show quoted text -



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,886
Default DSUM criteria

Hi Edward

Try
=SUMPRODUCT(($A$2:$A$1000=A2)*$B$2:$B$1000)

--
Regards

Roger Govier


"Edward" wrote in message
ups.com...
This resolves the A3, A4 problem but now the formula does not work. I
get the same result if I leave out the INDIRECT and just go with
tree=A2.

On Jul 9, 10:13 am, "Roger Govier"
wrote:
Hi Edward

Try using
tree=INDIRECT("A"&ROW(A2))
That will resolve to INDIRECT(A2) and change as you copy down to A3,
A4
etc.

--
Regards

Roger Govier

"Edward" wrote in message

ps.com...



Is there a way to assign the criteria for DSUM (or a similar
funciton)
without giving a range cells but a string literal or formula? I
came
up with something that works a little bit but is still having
problems:


A | B |
C | D
1 | tree | height | sum by type |
criteria
2 | apple | 1 | =DSUM(A$1:B$5,"height",D1:D2) |
=tree=INDIRECT("A2")
3 | pear | 2 | =DSUM(A$1:B$5,"height",D2:D3) |
=tree=INDIRECT("A3")
4 | apple | 3 | =DSUM(A$1:B$5,"height",D3:D4) |
=tree=INDIRECT("A4")
5 | fig | 4 | =DSUM(A$1:B$5,"height",D4:D5) |
=tree=INDIRECT("A5")


result:
A | B |
C | D
1 | tree | height | sum by type |
criteria
2 | apple | 1 |
5 | #NAME?
3 | pear | 2 |
2 | #NAME?
4 | apple | 3 |
5 | #NAME?
5 | fig | 4 |
8 | #NAME?


This does what I want (sums tree heights by type in column D) but
has
the problem that I cannot simply copy and paste the formula in D2
to
successive rows without manually changing the "A2" to "A3", etc.-
Hide quoted text -


- Show quoted text -





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
DSUM non-contiguous criteria RD Wirr Excel Worksheet Functions 5 December 14th 06 09:53 AM
DSum criteria Troubled Excel Worksheet Functions 2 November 8th 06 04:22 AM
HOW TO USE DSUM WITH MORE THAN ONE CRITERIA Michael H.M.Mikhail New Users to Excel 1 May 23rd 06 09:42 AM
Using DSUM with several criteria matthoffman33 Excel Worksheet Functions 2 May 6th 06 05:46 PM
conditional criteria in DSUM S. H. Drew Excel Discussion (Misc queries) 7 May 2nd 05 06:14 PM


All times are GMT +1. The time now is 11:56 AM.

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

About Us

"It's about Microsoft Excel"