Help with FILTER & SPILL and formatting...

MeaclH

Board Regular
Joined
Apr 2, 2014
Messages
96
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all,

I have a sheet I am working on that has a formula working perfectly. It cross checks the values in the column versus values required on a different sheet. For any values that aren't there, they are returned and spilt into the cells below. This is perfect.

However, as part of our work flow, when we have verified that the value is not required, I have a VBA that marks the value as crossed out. You will see the formatting change in column S5 is now plain black text as opposed to the bold red in others.
The problem I have, is the values in the column are changed regularly, so once I have changed the formatting of S5, and another value is removed from the column, that value is put in the top row, and pushes the others ones down. The formatting remains in S5 rather than sticking with the value.

I don't think I have explained that very well. I hope you can follow what I am asking for :) Essentialy, I'd like to keep the formatting with the value, rather than the cell. Or if you have any other suggestions on how to reflect the values that have been cross checked.

Formula in cell

=FILTER(DATA!$AM$3:$AM$19,NOT(COUNTIF(S11:S103,DATA!$AM$3:$AM$19)))

VBA used to format cells we have double checked.
VBA Code:
Sub MarkShiftCovered()
     Dim sCmt As String
    Dim rCell As Range
    
    sCmt = InputBox( _
      Prompt:="Have you covered this shift in it's entirety?" & vbCrLf & _
      "Please add details of how the shift has been covered. ie. OFF roster, extensions.", _
      Title:="Comment to Add")
    If sCmt = "" Then
        MsgBox "Not actioned. Has the shift been covered?"
    If StrPtr(sCmt) = 0 Then Exit Sub 'user cancelled inputbox
            Else
        For Each rCell In Selection
            With rCell
                ActiveSheet.Unprotect
                .ClearComments
                .AddComment
                .Comment.Text Text:=sCmt
            End With
        Next
    End If
    Set rCell = Nothing
Selection.Font.Color = RGB(0, 0, 0)
Selection.Interior.ColorIndex = xlNone
Selection.Font.Underline = False
Selection.Font.Bold = False
Selection.Font.Strikethrough = True
ActiveSheet.Protect DrawingObjects:=False
End Sub

DIGITAL ROSTER MACH2.xlsm
ABCDEFGHIJKLMNOPQRST
1
2FORTNIGHT COMMENCINGUNPUBLISHEDSUNDAYMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAYSUNDAYMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAY
31-Dec2-Dec3-Dec4-Dec5-Dec6-Dec7-Dec8-Dec9-Dec10-Dec11-Dec12-Dec13-Dec14-Dec
401-Dec-24Employee NameOpen ShiftsOpen ShiftsOpen ShiftsOpen ShiftsOpen ShiftsOpen ShiftsOpen ShiftsOpen ShiftsOpen ShiftsOpen ShiftsOpen ShiftsOpen ShiftsOpen ShiftsOpen Shifts
5#CALC!#CALC!#CALC!#CALC!#CALC!#CALC!#CALC!#CALC!#CALC!#CALC!#CALC!#CALC!0530TL1330TL
61330TL
7
8
9
10DAO Team Leaders
11Line 1Rostered T/LDONMEZ. KShift0530TL0530TL0530TL0530TL0530TLOFFOFFOFFOFFOFF0530TL0530TL0530TL
12Original T/LDONMEZ. KExtension
13Remarks####Remarks
14Line 2Rostered T/LCUGLIARI. DShift1330TL1330TLOFFOFF1330TL1330TL1330TL1330TL1330TL1330TL1330TLOFFOFFOFF
15Original T/LCUGLIARI. DExtension
16Remarks9Remarks
17Line 3Rostered T/LCROCE. BShiftOFFOFF1330TL1330TL2130TL2130TL2130TL2130TL2130TLOFF-UOFF-UOFF-UA/LA/L
18Original T/LCROCE. BExtension
19Remarks9Remarks
20Line 4Rostered T/LABDULRAHMAN. MShift2130TL2130TL2130TL2130TLOFFOFFOFFOFFOFF2130TL2130TL2130TL2130TL2130TL
21Original T/LABDULRAHMAN. MExtension
22Remarks9Remarks
23Line 5Rostered T/LPAPARIS. MShiftOFFOFFOFF0700AD0700AD0530TL0530TL0530TL0530TL0530TLOFF1330TL1200ADOFF
24Original T/LPAPARIS. MExtension
25Remarks9Remarks
FN 01DEC-14DEC24
Cell Formulas
RangeFormula
G3G3=IF(A4="","",A4)
H3:T3H3=IF(G3="","",G3+1)
G5,M5:N5,T5G5=FILTER(DATA!$AL$3:$AL$17,NOT(COUNTIF(G11:G103,DATA!$AL$3:$AL$17)))
H5:L5,O5:R5,S5:S6H5=FILTER(DATA!$AM$3:$AM$19,NOT(COUNTIF(H11:H103,DATA!$AM$3:$AM$19)))
C11,C23,C20,C17,C14C11=IF($A$4="","",VLOOKUP(CONCATENATE(VALUE($A$4),$A11),DATA!$U$3:$V$1568,2,0))
C12,C24,C21,C18,C15C12=IF($A$4="","",VLOOKUP(CONCATENATE(VALUE($A$4),$A11),DATA!$U$3:$V$1568,2,0))
E13,E25,E22,E19,E16E13=AR11
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G:G,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:TExpression=G$3=TODAY()textNO
G15:T15,G18:T18,G21:T21,G24:T24,G28:T28,G31:T31,G34:T34,G37:T37,G40:T40,G43:T43,G46:T46,G49:T49,G52:T52,G55:T55,G58:T58,G61:T61,G64:T64,G67:T67,G70:T70,G73:T73,G76:T76,G79:T79,G82:T82,G85:T85,G89:T89,G92:T92,G95:T95,G98:T98,G101:T101,G105:T105,G108:T108Cell Valueending with "?"textNO
G15:T15,G18:T18,G21:T21,G24:T24,G28:T28,G31:T31,G34:T34,G37:T37,G40:T40,G43:T43,G46:T46,G49:T49,G52:T52,G55:T55,G58:T58,G61:T61,G64:T64,G67:T67,G70:T70,G73:T73,G76:T76,G79:T79,G82:T82,G85:T85,G89:T89,G92:T92,G95:T95,G98:T98,G101:T101,G105:T105,G108:T108Cell Valuecontains "OK"textNO
G15:T15,G18:T18,G21:T21,G24:T24,G28:T28,G31:T31,G34:T34,G37:T37,G40:T40,G43:T43,G46:T46,G49:T49,G52:T52,G55:T55,G58:T58,G61:T61,G64:T64,G67:T67,G70:T70,G73:T73,G76:T76,G79:T79,G82:T82,G85:T85,G89:T89,G92:T92,G95:T95,G98:T98,G101:T101,G105:T105,G108:T108Cell Valuecontains "DEC"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "GAZETTE"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "AV"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "EDO-U"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "OFF-U"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "BLV"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "CTFN"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "CDO"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "STFN"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "SDO"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "LSL"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "A/L"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "PHC"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "OFF"textNO
G27:T86,G88:T102,G104:T118,G14:T25,G11:T11,G12,H12:T13Cell Valuecontains "EDO"textNO
G5:T5Cellcontains an errortextNO
E13,E16,E19,E22,E25Cell Value>=12textNO
E13,E16,E19,E22,E25Cell Value=11textNO
E13,E16,E19,E22,E25Cell Value=10textNO
E13,E16,E19,E22,E25Cell Value=9textNO
C2Cell Valuecontains "UNPUBLISHED"textNO
C2Cell Valuecontains "PUBLISHED"textNO
C12,C15,C18,C21,C24,C28,C43,C58,C73,C31,C46,C61,C76,C34,C49,C64,C79,C37,C52,C67,C82,C40,C55,C70,C85Expression=IF(C12=C11,TRUE)textNO
Cells with Data Validation
CellAllowCriteria
C11:E11List=DATA!$AB$4:$AB$12
C14:E14List=DATA!$AB$4:$AB$12
C17:E17List=DATA!$AB$4:$AB$12
C20:E20List=DATA!$AB$4:$AB$12
C23:E23List=DATA!$AB$4:$AB$12
G17:T17List=DATA!$AF$4:$AF$49
G11:T11List=DATA!$AF$4:$AF$49
G14:T14List=DATA!$AF$4:$AF$49
G20:T20List=DATA!$AF$4:$AF$49
G23:T23List=DATA!$AF$4:$AF$49
C2:E3List=DATA!$AJ$4:$AJ$5
A4:B9List=DATA!$W$4:$W$70
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
The problem I have, is the values in the column are changed regularly, so once I have changed the formatting of S5, and another value is removed from the column, that value is put in the top row, and pushes the others ones down. The formatting remains in S5 rather than sticking with the value.
Formatting:
I think using Conditional Formatting Rules may be best suited for your needs regarding the cell formatting.
To prevent empty/blank cells from formatting, add this rule to the top for your entire data range and Stop If True is checked.

1735516447426.png

Spills:
Is it supposed to spill below your DAO Team Leaders row? I noticed that row is MERGED as well. That can cause Spill errors. Try Centering Across Selection for the Alignment instead.

1735516007640.png
I just noticed your Dates and I think I have something that you'll like better... I'll be back.
 
Upvote 0
For the Dates, try this in a test Sheet. Enter your Start Date in A4 like you have it here.
It will SPILL to the RIGHT using TRANSPOSE for the Dates row.
If you want the Weekdays full name, change "ddd" to "dddd".
I added IF and ISBLANK incase there is no date in A4, else it will start with a ZERO date.
VBA Testing.xlsm
GHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAK
2SUNMONTUEWEDTHUFRISATSUNMONTUEWEDTHUFRISATSUNMONTUEWEDTHUFRISATSUNMONTUEWEDTHUFRISATSUNMONTUE
31-Dec2-Dec3-Dec4-Dec5-Dec6-Dec7-Dec8-Dec9-Dec10-Dec11-Dec12-Dec13-Dec14-Dec15-Dec16-Dec17-Dec18-Dec19-Dec20-Dec21-Dec22-Dec23-Dec24-Dec25-Dec26-Dec27-Dec28-Dec29-Dec30-Dec31-Dec
Filter-Spill
Cell Formulas
RangeFormula
G2:AK2G2=UPPER(TEXT(G3#,"ddd"))
G3:AK3G3=IF(ISBLANK(A4),"",TRANSPOSE(SEQUENCE(DAY(EOMONTH(A4,0)),1,A4)))
Dynamic array formulas.
 
Upvote 0
For the Dates, try this in a test Sheet. Enter your Start Date in A4 like you have it here.
It will SPILL to the RIGHT using TRANSPOSE for the Dates row.
If you want the Weekdays full name, change "ddd" to "dddd".
I added IF and ISBLANK incase there is no date in A4, else it will start with a ZERO date.
VBA Testing.xlsm
GHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAK
2SUNMONTUEWEDTHUFRISATSUNMONTUEWEDTHUFRISATSUNMONTUEWEDTHUFRISATSUNMONTUEWEDTHUFRISATSUNMONTUE
31-Dec2-Dec3-Dec4-Dec5-Dec6-Dec7-Dec8-Dec9-Dec10-Dec11-Dec12-Dec13-Dec14-Dec15-Dec16-Dec17-Dec18-Dec19-Dec20-Dec21-Dec22-Dec23-Dec24-Dec25-Dec26-Dec27-Dec28-Dec29-Dec30-Dec31-Dec
Filter-Spill
Cell Formulas
RangeFormula
G2:AK2G2=UPPER(TEXT(G3#,"ddd"))
G3:AK3G3=IF(ISBLANK(A4),"",TRANSPOSE(SEQUENCE(DAY(EOMONTH(A4,0)),1,A4)))
Dynamic array formulas.
Hey Zero!
Sorry for the delay replying, have been on holidays. This is a handy improvement, thank you!

1 thing about it though, is the formula spills an entire months worth of dates, however my sheet only works in fortnights. Is there a way for it to spill only 14 dates based on A4 value.

Cheers
Hayden
 
Upvote 0
Formatting:
I think using Conditional Formatting Rules may be best suited for your needs regarding the cell formatting.
To prevent empty/blank cells from formatting, add this rule to the top for your entire data range and Stop If True is checked.


Spills:
Is it supposed to spill below your DAO Team Leaders row? I noticed that row is MERGED as well. That can cause Spill errors. Try Centering Across Selection for the Alignment instead.

I just noticed your Dates and I think I have something that you'll like better... I'll be back.
Thanks again for these tips. Yeah, the formatting is a little tricky. Not sure if there is a fix for my problem, I might have to figure out another way to process the changes we make.

As for the spilling, it is very unlikely there would be that number of values that would cause it to spill below.
Cheers!
 
Upvote 0

Forum statistics

Threads
1,225,619
Messages
6,186,047
Members
453,335
Latest member
sfd039

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