Named Range Help

wtsabo

New Member
Joined
Mar 3, 2010
Messages
37
Hello,
I am trying to use named ranges to define a group of variables that will be used in a sumproduct, but I am return errors.

For example:

Sheet 1:
Name ranges
Apple = {1.000.1, 1.000.2, 1.000.3}
Banana = {2.000.1, 2.000.2, 2.000.3, 2.000}
Carrot = {3.000.1, 3.000.2, 3.000.3, c.0000}

Sheet 2:
DateValueGroup
01/02/201251.000.1
4/30/2012101.000.2
5/14/2012151.000.3
6/8/2012203.000.1

<tbody>
</tbody>


Sheet 3:
Reference Cell = Apple
Date Range = January 1, 2012 to May 31, 2012
Results Cell = Sumproduct(((Indirect(Apple)=(Sheet 2! Group Array))*(Sheet 2! Value Array)*(Date Array<June 1,2012))
Answer = 30

The error is created by the reference for the 'apple' named range. Can someone please assist?

Thank you
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
With the named constant (not range) Apple that refers to:

={"1.000.1","1.000.2","1.000.3"}

this formula will return the number of Apples in C2:C5:

=SUMPRODUCT(--ISNUMBER(MATCH(C2:C5,Apple,FALSE)))

Maybe you can expand the formula to suit.
 

wtsabo

New Member
Joined
Mar 3, 2010
Messages
37
Do you mean expanding the formula for each constant?
Such as:
=sumproduct(isnumber(MATCH(C2:C5,Apple,FALSE)))*isnumber(MATCH(C2:C5,banana,FALSE)))*isnumber(MATCH(C2:C5,carrot,FALSE))--)

If so, this method is going to result in a very long/complex formula. It might be easier to adjust my data source just to create a group column using the known associations, but is there a better alternative?
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Do you mean expanding the formula for each constant?
Such as:
=sumproduct(isnumber(MATCH(C2:C5,Apple,FALSE)))*isnumber(MATCH(C2:C5,banana,FALSE)))*isnumber(MATCH(C2:C5,carrot,FALSE))--)
No just add the other criteria that you want to the formula, eg a date range.
 

Forum statistics

Threads
1,081,530
Messages
5,359,347
Members
400,524
Latest member
Excelbat

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top