calculate consecutive days

xeven_

Active Member
Joined
Jan 20, 2012
Messages
302
I have % data in column F. I want to calculate only the consecutive positive or negative days adjacently in column G as shown in the illustration, Is there a formula I can enter as I have to go back quite a number of years/days and this is very time consuming doing it manually.
Thanks in advance. ;)


451.00%1.02%
45-0.46%
450.38%
45-0.02%
450.02%
460.99%
461.16%
460.09%
470.47%2.73%
47-0.04%
470.94%
470.13%1.07%
45-4.39%
45-0.31%
45-0.69%
44-0.90%
44-0.48%
440.05%
440.50%0.55%

<colgroup><col width="67" style="width:51pt"> <col width="67" style="width:51pt"> <col width="67" style="width:51pt"> </colgroup><tbody>
</tbody>
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
YrCxKH.jpg
 
Upvote 0
It isn't clear to me.

1. In post 2, are you trying to calculate the figures in column G, or column H, or both?

2. In your original post you mentioned consecutive positive or negative, but your screen shot only seems to be about positives. Please clarify.

3. Would it matter if the single positive (or negative) value rows were also calculated?
 
Upvote 0

Excel 2016 (Windows) 32 bit
FGH
11.00%  
2-0.46%
30.38%
4-0.02%
50.02%
60.99%
71.16%
80.09%
90.47%2.73%5
10-0.04%
110.94%
120.13%1.07%2
13-4.39%
14-0.31%
15-0.69%
16-0.90%
17-0.48%
180.05%
190.50%0.55%2
Sheet1
Cell Formulas
RangeFormula
G1=IF($H1="","",SUM(OFFSET($F1,1-$H1,0,$H1)))
H1=IF($F1<0,"",IF(OR($F2<0,$F2=""),IF(ROW()>1,IF(OFFSET($F1,-1,0)<0,"",ROW()-LOOKUP(2,1/($F$1:$F1<0),ROW($F$1:$F1))),""),""))


WBD
 
Last edited:
Upvote 0
Peter..yes I should have been more precise. Primarily calculate the clustered percent changes in G and the days in H as shown in the screen shot. I want to do the negatives as well but on the right hand side of the page. so the final hoped for result will be able to do this. See screen shot below:
Jpv1SE.jpg
 
Last edited:
Upvote 0
Wideboydixon that is awesome. :LOL:

Hey I tried to color code it via the conditional formatting and it it turning even my empty cells green. I wonder if there is a ways to make it not do that?
S1U2v9.jpg
 
Upvote 0
Also it is tallying/counting all highlighted cells.Is there a way to make it not do that? See screenshot:
1l65gx.jpg
 
Upvote 0
Select a contiguous range and use a formula to format the cells. For example, I selected $F$1:$H$19 and used this formula:

Code:
=AND(F1>0,F1<>"")

WBD
 
Upvote 0

Forum statistics

Threads
1,215,343
Messages
6,124,405
Members
449,157
Latest member
mytux

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top