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>
 
Select cells F1:H19 (for example) and go to Conditional Formatting > New Rule where you select Use a formula. This is where you enter the formula above and then select the appropriate formatting (green in this case). Replace F1 in the formula with the first cell in your selection so, for example, if you selected F5:H100 use:

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

WBD
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I have another suggestion without using the volatile function OFFSET. My suggestion does assume that there is at least one header row above the actual data.

For the values in columns G:J, try the cell formulas shown below, copied down.

For the Conditional Formatting, select from cell F2 down to K?? and enter the Conditional Formatting formulas shown.

Excel Workbook
FGHIJK
1ValueSumCountCountSumValue
20.02%    0.02%
31.00%1.02%21.00%
4-0.46%-0.46%
50.38%0.38%
6-0.02%-0.02%
70.02%0.02%
80.99%0.99%
91.16%1.16%
100.09%0.09%
110.47%2.73%50.47%
12-0.04%-0.04%
130.94%0.94%
140.13%1.07%20.13%
15-4.39%-4.39%
16-0.31%-0.31%
17-0.69%-0.69%
18-0.90%-0.90%
19-0.48%5-6.77%-0.48%
200.05%0.05%
210.50%0.55%20.50%
22
Consecutive
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F21. / Formula is =AND($F2<0,N(F2))Abc
F22. / Formula is =AND($F2>0,N(F2))Abc
 
Upvote 0
raUjgt.jpg
Peter that is just about perfect!!! Hey is there anyway to make the empty or blank cells not count when highlighting them? As it is the bottom information bar gives me the correct average but gives me a false count as in counting even the cells that are blank but contains the formula.

Thanks again (AWESOME HELP) :LOL:
 
Last edited:
Upvote 0
Peter that is just about perfect!!! Hey is there anyway to make the empty or blank cells not count when highlighting them? As it is the bottom information bar gives me the correct average but gives me a false count as in counting even the cells that are blank but contains the formula.
That is because the cells are not blank. A formula cannot leave a cell truly blank - the best it can do is put a null string ("") in it, which is what the formula does.
"Count:" at the bottom right is meant to count all cells that have anything in them, so it is giving the correct count in that regard.

Right click in that bottom right information area and you should have a choice to tick "Numerical Count" or perhaps "Count Numbers" and that should give the count that you are looking for
 
Upvote 0

Forum statistics

Threads
1,216,041
Messages
6,128,467
Members
449,455
Latest member
jesski

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