Solution for Excel 2016 number of consecutive cells in row = 3 does not quite work

Gregory123987

New Member
Joined
Jun 23, 2020
Messages
33
Office Version
  1. 2016
Platform
  1. Windows
I had needed a solution to automatically provide conditional formatting if there were consecutive days with values. Unfortunately, the solution that was found did not highlight the 3rd consecutive cell for the current month if there were more than 2 cells ending the previous month. The 9 hidden columns to the left of column M have a value if column J (previous month) has a value.

The same issue applies for 5 and 10 cells as well, but I can fix this myself if someone can help with a solution for the 3rd consecutive cell issue I just described. A link to the previous thread is below.

FYI - I did not do a proper job of testing it as time was of the essence. It has been a year since then and I noticed the issue as I was making changes to the spreadsheet. Thank you in advance for your help.

It took me a while but I managed to figure out a solution. Here it for your info. Thanks for your help.

Added hidden columns, View attachment 19961

Expanded conditional formatting to include applicable columns, wrapped Column with And and added cell reference such as the following to change from
=COLUMN()=(MIN(IF(($M18:$AG18<>"")*($M18:$AH18<>"")*($M18:$AI18<>""),COLUMN($M$16:$AG$16)+2))) to
=AND($J18<3,(COLUMN()=(MIN(IF(($T18:$AP18<>"")*($U18:$AQ18<>"")*($V18:$AR18<>""),COLUMN($T$16:$AP$16)+2)))))
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
As you're effectively starting again it would be beneficial to provide a summary of the relevant information (with a visual example) rather than cross linking to multiple threads with some detail pointlessly hidden behind spoiler tags.

As the hidden columns appear to be a significant point, I would advise making it clear in your example which columns are hidden and how they should affect the outcome.
 
Upvote 0
As you're effectively starting again it would be beneficial to provide a summary of the relevant information (with a visual example) rather than cross linking to multiple threads with some detail pointlessly hidden behind spoiler tags.

As the hidden columns appear to be a significant point, I would advise making it clear in your example which columns are hidden and how they should affect the outcome.
Thank you for your advice, I will do that.
 
Upvote 0
One thought that I just had whilst looking at your earlier sample. If you're saying that there are 9 hidden columns between (for example) Jan 31st and Feb 1st then that would mean that they can not be evaluated as consecutive.

It might be possible if the headers are proper dates (day month and year) formatted as day, but not of they are entered as day only.
 
Upvote 0
EDITED WITH CORRECT SHEET.

Here is the xl2bb from my spreadsheet. All rows / columns are unhidden.

What is supposed to happen is each month a person is able to reach achievements for 3, 5 and 10 consecutive days, which includes the consecutive days from the previous month. When they do, the cell is supposed to be highlighted in the appropriate color.

Some explanations to answer some questions that may probabaly come up:

Cols W:AE are the hidden columns that illustrate the consecutive days from the previous month as counted in col J to accommodate the conditional highlighting formulas.
Col P determines the ending consecutive columns for the current month which are linked to Column J on next month's sheet.
Cols AF:BE collects the number of laps run for each person and contain the conditional formulas to highlight the cells when applicable.

Rows 1 thru 5:
  1. There were no consecutive days the previous month (which is true even if the person missed only the last day) and works as it should for the current month.
  2. There were no consecutive days the previous month and works as it should for the current month, even when a day (in the current month) was missed.
  3. There were no consecutive days the previous month and works as it should for the current month, even when a day (in the current month) was missed more than once.
  4. > 2 and yellow highlighting does not work cell AJ27.
  5. > 4 and yellow highlighting does not work cell AJ28, and orange highlighting does not work in AL28.
  6. Shows 9 consecutive days and highlights for day 10, yet illustrates no highlighting for the current month, which there should be for days 3 and 5.
  7. Shows perfect attendance yet illustrates no highlighting for the current month, which there should be for days 3, 5 and 10.
Row 34 shows how the highlighting should be with previous consecutive days.

And, @jasonb75, they are numbers only.

Book1.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBDBEBF
1INCENTIVES KEYPARTICIPANT STATISTICS
2ColorAchievementIncentive
31st DayVirtual pat on the backNumber of Previous Participants:0
43rd Consecutive Day*Running ShoesNew Participants this Month:7
55th Consecutive Day*Team ShirtYTD Particpants:7
610th Consecutive Day*$10 Gift CardAverage # Participants per Day:7
750 Laps This Month31 Day VIA PassTotal New Members this Month:0
8Consecutive days
93Applicable Conditional formulas in cell AF24=AND($J24<3,(COLUMN()=(MIN(IF(($AD24:$BC24<>"")*($AE24:$BD24<>"")*($AF24:$BE24<>""),COLUMN($AD$21:$BC$21)+2)))))
105=AND($J24<5,COLUMN()=(MIN(IF(($AB24:$BA24<>"")*($AC24:$BB24<>"")*($AD24:$BC24<>"")*($AE24:$BD24<>"")*($AF24:$BE24<>""),COLUMN($AB21:$BA21)+4))))
1110=AND($J24<10,COLUMN()=(MIN(IF(($W24:$AV24<>"")*($X24:$AW24<>"")*($Y24:$AX24<>"")*($Z24:$AY24<>"")*($AA24:$AZ24<>"")*($AB24:$BA24<>"")*($AC24:$BB24<>"")*($AD24:$BC24<>"")*($AE24:$BD24<>"")*($AF24:$BE24<>""),COLUMN($W$21:$AV$21)+9))))
12
13
14
15January 2021
16Prior Month TotalsThis Month TotalsHidden Columns Consecutive Days Markers for Conditional Formulas# Participants per Day Totals
170004900173107173Hidden column107173000073777777777776666677777777
18PRIOR MonthThis MonthFor counting Consecutive entries up to the last day for the month to be read on the next month. If the last day is blank consecutive days will be 0YEAR TO DATELAPS RUN
19FSMTWTHFSMTWTHFSMTWTHFSMTWTHFS
20These columns come from the previous monthThese columns go to the next monthHidden Row1234567891011121314151617181920212223242526
21Total LapsTotal MilesTotal # DaysConsecutive DaysTotal Miles YTDTotal Days YTDTotal Laps RunTotal Miles Run# of DaysTotal MilesTotal Days98765432112456789111213141516181920212223252627282930
22
23Person100000021132181321         111111111111111111111
24Person2000000251625241625         1111111111111111111111111
25Person3000200251625241625       111111111111111111111111111
26Person4000300251625241625      1111111111111111111111111111
27Person5000400251625241625     11111111111111111111111111111
28Person600090026162626162611111111111111111111111111111111111
29Person7000310026162626162611111111111111111111111111111111111
30000000000000         
31000000000000         
32000000000000         
33
34Person2200090026162626162611111111111111111111111111111111111
Jan
Cell Formulas
RangeFormula
BE3BE3=COUNTIF(H23:H32,">0")
BE4BE4=COUNTIF(M23:M32,">0")
BE5BE5=SUM(BE3:BE4)
BE6BE6=IF(SUM(AF17:BE17)>0,SUM(AF17:BE17)/COUNTIF(AF17:BE17,">0"),0)
BE7BE7=COUNTIF(B23:B32,"Y")
Q17:V17,G17:O17G17=SUM(G23:G32)
AF17:BE17AF17=COUNT(AF23:AF32)
M34,M23:M32M23=SUM($AF23:$BE23)
N23N23=$M23*0.6213
O23O23=COUNT($AF23:$BE23)
P34,P23:P32P23=IF(M23<>0,($BE$20-(MAX(($AF23:$BE23="")*($AF$20:$BE$20)))),0)
Q34,Q23:Q32Q23=+N23+K23
R34,R23:R32R23=SUM(L23+O23)
N34,N24:N32N24=M24*0.6213
O34,O24:O32O24=COUNT(AF24:BE24)
W34:AE34,W23:AE32W23=IF($J23=0,"",IF($J23>=W$21,1,""))
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
W34:AE34Expression=AND($J34<10,COLUMN()=(MIN(IF(($M34:$AL34<>"")*($N34:$AM34<>"")*($O34:$AN34<>"")*($P34:$AO34<>"")*($Q34:$AP34<>"")*($R34:$AQ34<>"")*($S34:$AR34<>"")*($T34:$AS34<>"")*($U34:$AT34<>"")*($V34:$AT34<>""),COLUMN($M$21:$AL$21)+9))))textNO
AB34:AE34Expression=AND($J34<5,COLUMN()=(MIN(IF(($R34:$AQ34<>"")*($S34:$AR34<>"")*($T34:$AS34<>"")*($U34:$AT34<>"")*($V34:$AT34<>""),COLUMN($R32:$AQ32)+4))))textNO
AD34:AE34Expression=AND($J34<3,(COLUMN()=(MIN(IF(($T34:$AS34<>"")*($U34:$AT34<>"")*($V34:$AT34<>""),COLUMN($T$21:$AS$21)+2)))))textNO
C34:D34Expression=ISFORMULA(C34)textNO
M34Cell Value>=50textNO
W23:AE32Expression=AND($J23<10,COLUMN()=(MIN(IF(($M23:$AL23<>"")*($N23:$AM23<>"")*($O23:$AN23<>"")*($P23:$AO23<>"")*($Q23:$AP23<>"")*($R23:$AQ23<>"")*($S23:$AR23<>"")*($T23:$AS23<>"")*($U23:$AT23<>"")*($V23:$AT23<>""),COLUMN($M$21:$AL$21)+9))))textNO
AB23:AE32Expression=AND($J23<5,COLUMN()=(MIN(IF(($R23:$AQ23<>"")*($S23:$AR23<>"")*($T23:$AS23<>"")*($U23:$AT23<>"")*($V23:$AT23<>""),COLUMN($R21:$AQ21)+4))))textNO
AD23:AE32Expression=AND($J23<3,(COLUMN()=(MIN(IF(($T23:$AS23<>"")*($U23:$AT23<>"")*($V23:$AT23<>""),COLUMN($T$21:$AS$21)+2)))))textNO
AF26:BE32Expression=AND($J26<10,COLUMN()=(MIN(IF(($W26:$AV26<>"")*($X26:$AW26<>"")*($Y26:$AX26<>"")*($Z26:$AY26<>"")*($AA26:$AZ26<>"")*($AB26:$BA26<>"")*($AC26:$BB26<>"")*($AD26:$BC26<>"")*($AE26:$BD26<>"")*($AF26:$BE26<>""),COLUMN($W$21:$AV$21)+9))))textNO
AF25:BE32Expression=AND($J25<5,COLUMN()=(MIN(IF(($R25:$AN25<>"")*($S25:$AO25<>"")*($T25:$AP25<>"")*($U25:$AQ25<>"")*($V25:$AR25<>""),COLUMN($R23:$AN23)+4))))textYES
AF23:BE32Expression=AND($J23<3,(COLUMN()=(MIN(IF(($AD23:$BC23<>"")*($AE23:$BD23<>"")*($AF23:$BE23<>""),COLUMN($AD$21:$BC$21)+2)))))textNO
AJ23:AJ32Expression=AND($J23=0,(COUNTA($AF23:$AI23)=0),NOT(ISBLANK($AJ23)))textNO
AI23:AI32Expression=AND($J23=0,(COUNTA($AF23:$AH23)=0),NOT(ISBLANK($AI23)))textNO
C23:D32Expression=ISFORMULA(C23)textNO
AK23:AK32Expression=AND($J23=0,(COUNTA($AF23:$AJ23)=0),NOT(ISBLANK($AK23)))textNO
AL23:AL32Expression=AND($J23=0,(COUNTA($AF23:$AK23)=0),NOT(ISBLANK($AL23)))textNO
M23:M32Cell Value>=50textNO
AM23:AM32Expression=AND($J23=0,(COUNTA($AF23:$AL23)=0),NOT(ISBLANK($AM23)))textNO
AN23:AN32Expression=AND($J23=0,(COUNTA($AF23:$AM23)=0),NOT(ISBLANK($AN23)))textNO
AO23:AO32Expression=AND($J23=0,(COUNTA($AF23:$AN23)=0),NOT(ISBLANK($AO23)))textNO
AP23:AP32Expression=AND($J23=0,(COUNTA($AF23:$AO23)=0),NOT(ISBLANK($AP23)))textNO
AQ23:AQ32Expression=AND($J23=0,(COUNTA($AF23:$AP23)=0),NOT(ISBLANK($AQ23)))textNO
AR23:AR32Expression=AND($J23=0,(COUNTA($AF23:$AQ23)=0),NOT(ISBLANK($AR23)))textNO
AS23:AS32Expression=AND($J23=0,(COUNTA($AF23:$AR23)=0),NOT(ISBLANK($AS23)))textNO
AT23:AT32Expression=AND($J23=0,(COUNTA($AF23:$AS23)=0),NOT(ISBLANK($AT23)))textNO
AU23:AU32Expression=AND($J23=0,(COUNTA($AF23:$AT23)=0),NOT(ISBLANK($AU23)))textNO
AV23:AV32Expression=AND($J23=0,(COUNTA($AF23:$AU23)=0),NOT(ISBLANK($AV23)))textNO
AW23:AW32Expression=AND($J23=0,(COUNTA($AF23:$AV23)=0),NOT(ISBLANK($AW23)))textNO
AX23:AX32Expression=AND($J23=0,(COUNTA($AF23:$AW23)=0),NOT(ISBLANK($AX23)))textNO
AY23:AY32Expression=AND($J23=0,(COUNTA($AF23:$AX23)=0),NOT(ISBLANK($AY23)))textNO
AZ23:AZ32Expression=AND($J23=0,(COUNTA($AF23:$AY23)=0),NOT(ISBLANK($AZ23)))textNO
BA23:BA32Expression=AND($J23=0,(COUNTA($AF23:$AZ23)=0),NOT(ISBLANK($BA23)))textNO
BC23:BC32Expression=AND($J23=0,(COUNTA($AF23:$BB23)=0),NOT(ISBLANK($BC23)))textNO
BE23:BE32Expression=AND($J23=0,(ISBLANK($AF23:$BD23)),NOT(ISBLANK($BE23)))textNO
BD23:BD32Expression=AND($J23=0,(COUNTA($AF23:$BC23)=0),NOT(ISBLANK($BD23)))textNO
BB23:BB32Expression=AND($J23=0,(COUNTA($AF23:$BA23)=0),NOT(ISBLANK($BB23)))textNO
AH23:AH32Expression=AND($J23=0,(COUNTA($AF23:$AG23)=0),NOT(ISBLANK($AH23)))textNO
AF26:BE32Expression=AND($J26<5,COLUMN()=(MIN(IF(($AB26:$BA26<>"")*($AC26:$BB26<>"")*($AD26:$BC26<>"")*($AE26:$BD26<>"")*($AF26:$BE26<>""),COLUMN($AB23:$BA23)+4))))textNO
AG23:AG32Expression=AND($J23=0,(COUNTA($AF23)=0),NOT(ISBLANK($AG23)))textNO
AF23:AF32Expression=AND($J23=0,NOT(ISBLANK($AF23)))textNO
AF23:BE24Expression=AND($J23<10,COLUMN()=(MIN(IF(($W23:$AV23<>"")*($X23:$AW23<>"")*($Y23:$AX23<>"")*($Z23:$AY23<>"")*($AA23:$AZ23<>"")*($AB23:$BA23<>"")*($AC23:$BB23<>"")*($AD23:$BC23<>"")*($AE23:$BD23<>"")*($AF23:$BE23<>""),COLUMN($W$21:$AV$21)+9))))textNO
AF23:BE24Expression=AND($J23<5,COLUMN()=(MIN(IF(($AB23:$BA23<>"")*($AC23:$BB23<>"")*($AD23:$BC23<>"")*($AE23:$BD23<>"")*($AF23:$BE23<>""),COLUMN($AB21:$BA21)+4))))textNO
AF25:BE25Expression=AND($J25<10,COLUMN()=(MIN(IF(($W25:$AV25<>"")*($X25:$AW25<>"")*($Y25:$AX25<>"")*($Z25:$AY25<>"")*($AA25:$AZ25<>"")*($AB25:$BA25<>"")*($AC25:$BB25<>"")*($AD25:$BC25<>"")*($AE25:$BD25<>"")*($AF25:$BE25<>""),COLUMN($W$21:$AV$21)+9))))textNO
AF25:BE25Expression=AND($J25<5,COLUMN()=(MIN(IF(($AB25:$BA25<>"")*($AC25:$BB25<>"")*($AD25:$BC25<>"")*($AE25:$BD25<>"")*($AF25:$BE25<>""),COLUMN(#REF!)+4))))textNO
 
Upvote 0
I thought that I had an idea of what you meant, but with the 'correct sheet' from your edited post, I'm not so sure.
> 2 and yellow highlighting does not work cell AJ27.
Should AJ27 be AP24 with the revised example? If so then I think that I have just about figured out what is needed, although I will probably not start on a solution until the morning.

One question that I don't see covered in the example. With the missing entry in the middle of the row shown below, is this what you would expect?
Manexcel.xlsx
ALAMANAOAPAQARASATAU
37111111111
Sheet11
 
Upvote 0
I thought that I had an idea of what you meant, but with the 'correct sheet' from your edited post, I'm not so sure.

Should AJ27 be AP24 with the revised example? If so then I think that I have just about figured out what is needed, although I will probably not start on a solution until the morning.

One question that I don't see covered in the example. With the missing entry in the middle of the row shown below, is this what you would expect?
Manexcel.xlsx
ALAMANAOAPAQARASATAU
37111111111
Sheet11
I had edited my post with the correct spreadsheet. I think you have the previous one.
 
Upvote 0
Referring back to your earlier thread, does this condition no longer apply?
The highlighting should not occur in Cells Q2, W2, AE2 as they are not the first occurrence.
As far as I can see,
> 2 and yellow highlighting does not work cell AJ27.
AJ27 is the second occurrence, with the first occurrence being at the end of the previous month.

Also, looking at row 34 in the example, are you saying that 13 consecutive days should highlight the same as 3, 15 days the same as 5, etc?
 
Upvote 0
I thought that I had an idea of what you meant, but with the 'correct sheet' from your edited post, I'm not so sure.

Should AJ27 be AP24 with the revised example? If so then I think that I have just about figured out what is needed, although I will probably not start on a solution until the morning.

One question that I don't see covered in the example. With the missing entry in the middle of the row shown below, is this what you would expect?
Referring back to your earlier thread, does this condition no longer apply?

As far as I can see,

AJ27 is the second occurrence, with the first occurrence being at the end of the previous month.

Also, looking at row 34 in the example, are you saying that 13 consecutive days should highlight the same as 3, 15 days the same as 5, etc?
AJ 27 is the first occurrence for the month. It should have highlighted, but the formulas being used won't allow it (AND($J27<3,...) . This is what the issue is. If I leave out the AND($J27<3,...) it does not work correctly either.

There is only a single occurrence of each achievement during the month, and only the first occurrence of each should highlight. If there are 13 consecutive days, it would satisfy the requirements for the 3rd, 5th and 10th consecutive day achievements.
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

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