Pregunta

I have a time-series table of data, (deals by row, date by column, beginning A1):

>Series    9/30/12   10/31/12   11/30/12   12/31/12
 Deal 1     750.0      750.0      750.0      750.0
 Deal 2     300.0      150.0      300.0      300.0
 Deal 3     500.0      500.0      600.0      500.0
 Deal 4     340.0      500.0      250.0      340.0
 Total     1890.0     1900.0     1900.0     1890.0

I want to sum the variance between each row in two columns, using date as a variable and only if the variance is positive. The real trick is I do not want the net of increasing and decreasing values by deal. I was able to get it to work by specifying the two columns that I wanted to use resulting in 160 for the increase in Deal 4 from 10/31 to 9/30 (it ignored the 150 decrease in Deal 2 from 10/31 to 9/30)

=SUMPRODUCT((IF((C2:C5)-(B2:B5)>0,(C2:C5)-(B2:B5))))

Once I try to apply any sort of date variable to the selected ranges, it breaks down. I tried using several different operators to allow the date to be selected by a variable cell, but once I am able to get the formula to accept, it goes back to the net value.

¿Fue útil?

Solución

Taking L1 and M1 as the required boundaries for a range, a formula is possible (but it did rather get out of hand - and hopefully something much simpler will turn up!):

=IFERROR(SUMPRODUCT((IF(INDIRECT(CHAR(64+MATCH(M$1,$A$1:$E$1,0))&"2:"&CHAR(64+MATCH(M$1,$A$1:$E$1,0))&"5")-INDIRECT(CHAR(64+MATCH(L$1,$A$1:$E$1,0))&"2:"&CHAR(64+MATCH(L$1,$A$1:$E$1,0))&"5")>0,INDIRECT(CHAR(64+MATCH(M$1,$A$1:$E$1,0))&"2:"&CHAR(64+MATCH(M$1,$A$1:$E$1,0))&"5")-INDIRECT(CHAR(64+MATCH(L$1,$A$1:$E$1,0))&"2:"&CHAR(64+MATCH(L$1,$A$1:$E$1,0))&"5")))),"")

in M2 and copied down to M5.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top