Add certain cells given specific criteria

  • Thread starter Thread starter hcronrath
  • Start date Start date
H

hcronrath

On sheet 1 Column1 is a date function that returns the number of months sales
have come in, it is formatted as a number. On the same sheet in Column 2 I
want to sum the sales from another sheet ('PTD Comp Finney'!).

Sheet 1 Data
Column 1 Column 2
0 =IFERROR('PTD Comp Finney'!D16," ") - This is correct

1 =IFERROR('PTD Comp Finney'!D16," ") - If column 1=1, then I
want to calculate =IFERROR('PTD Comp Finney'!D16:D17," ")

2 =IFERROR('PTD Comp Finney'!D16," ")- If column 1=2, then I
want to calculate =IFERROR('PTD Comp Finney'!D16:D18," ")

3 =IFERROR('PTD Comp Finney'!D16," ")- If column 1=3, then I
want to calculate =IFERROR('PTD Comp Finney'!D16:D19," ")

4 =IFERROR('PTD Comp Finney'!D16," ")- If column 1=4, then I
want to calculate =IFERROR('PTD Comp Finney'!D16:D20," ")

5 =IFERROR('PTD Comp Finney'!D16," ")- If column 1=5, then I
want to calculate =IFERROR('PTD Comp Finney'!D16:D21," ")

and so on...

Any help would be most appreciated.
 
Put this in B1
=IFERROR(SUM(INDIRECT("'PTD Comp Finney'!D16:D"&(16+A1))),"")

By putting appropriate number in A1 (0,1,2,...) you will get the answer you
want in B1

You can also copy this down and get different answers by putting different
numbers in Col A
 
I think what you want to do is something like this:

=IFERROR(SUM(INDIRECT("'PTD Comp Finney'!D16:D"&16+A1)),"")

and then copy down.

Hope this helps.

Pete
 
Back
Top