Hi
I'm trying to figure out how to get the First date the Price was over or below the Average Price.
The first thing needed is to see if the current price (dec 23,2016) is above or below the average. If the current price is above the average the result should be positive but if the result was current price is below the average the result should be negative.
I need to find (in the example) when the First time (Date) the price was above the current average (as the current price is above the average) the result should be Positive (Dec 23,2016) - First day price was above the average (Dec 19, 2016) =Should Return 4.
[TABLE="width: 130"]
<tbody>[TR]
[TD="width: 65"]Current Average[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl65, width: 65, align: right"]$23.25[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Price[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]23-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$24.22[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]22-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$24.20[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]21-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.85[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]20-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.90[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]19-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.60[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]16-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.06[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]15-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.43[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]14-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.41[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]13-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.64[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]12-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.53[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]9-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.46[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]8-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.46[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]7-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.99[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]6-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.90[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]5-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.84[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]2-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.64[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]1-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.86[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]30-Nov-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.30[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]29-Nov-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.54[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]28-Nov-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.41[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]25-Nov-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.21[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]23-Nov-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.08[/TD]
[/TR]
</tbody>[/TABLE]
In this example the result should be a negative number as the Last price (Dec 23, 2016) is below the average. The result should be (Dec 23,2016) - First date below average (Dec 14,2016) results = -9
Average 0.53
23-Dec-16 0.49
22-Dec-16. 0.52
21-Dec-16. 0.52
20-Dec-16. 0.50
19-Dec-16. 0.51
16-Dec-16. 0.52
15-Dec-16. 0.52
14-Dec-16. 0.51
13-Dec-16. 0.53
12-Dec-16. 0.52
9-Dec-16 0.53
8-Dec-16. 0.53
7-Dec-16. 0.54
6-Dec-16. 0.53
5-Dec-16. 0.53
2-Dec-16. 0.51
1-Dec-16. 0.51
30-Nov-16. 0.53
29-Nov-16. 0.53
28-Nov-16. 0.53
25-Nov-16. 0.55
24-Nov-16. 0.54
23-Nov-16. 0.56
If you can help that would be great.
Thank you
I'm trying to figure out how to get the First date the Price was over or below the Average Price.
The first thing needed is to see if the current price (dec 23,2016) is above or below the average. If the current price is above the average the result should be positive but if the result was current price is below the average the result should be negative.
I need to find (in the example) when the First time (Date) the price was above the current average (as the current price is above the average) the result should be Positive (Dec 23,2016) - First day price was above the average (Dec 19, 2016) =Should Return 4.
[TABLE="width: 130"]
<tbody>[TR]
[TD="width: 65"]Current Average[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl65, width: 65, align: right"]$23.25[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Price[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]23-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$24.22[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]22-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$24.20[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]21-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.85[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]20-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.90[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]19-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.60[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]16-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.06[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]15-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.43[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]14-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.41[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]13-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.64[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]12-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.53[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]9-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.46[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]8-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.46[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]7-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.99[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]6-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.90[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]5-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.84[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]2-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.64[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]1-Dec-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.86[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]30-Nov-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.30[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]29-Nov-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.54[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]28-Nov-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$22.41[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]25-Nov-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.21[/TD]
[/TR]
[TR]
[TD="class: gmail-m_7317369843439429420gmail-xl63, align: right"]23-Nov-16[/TD]
[TD="class: gmail-m_7317369843439429420gmail-xl64, align: right"]$23.08[/TD]
[/TR]
</tbody>[/TABLE]
In this example the result should be a negative number as the Last price (Dec 23, 2016) is below the average. The result should be (Dec 23,2016) - First date below average (Dec 14,2016) results = -9
Average 0.53
23-Dec-16 0.49
22-Dec-16. 0.52
21-Dec-16. 0.52
20-Dec-16. 0.50
19-Dec-16. 0.51
16-Dec-16. 0.52
15-Dec-16. 0.52
14-Dec-16. 0.51
13-Dec-16. 0.53
12-Dec-16. 0.52
9-Dec-16 0.53
8-Dec-16. 0.53
7-Dec-16. 0.54
6-Dec-16. 0.53
5-Dec-16. 0.53
2-Dec-16. 0.51
1-Dec-16. 0.51
30-Nov-16. 0.53
29-Nov-16. 0.53
28-Nov-16. 0.53
25-Nov-16. 0.55
24-Nov-16. 0.54
23-Nov-16. 0.56
If you can help that would be great.
Thank you