Greetings,
I need some assistance with incorporating last column into a formula.
The output is -
My trouble is that column N can move depending on the number of courses available to be completed.
The VB code for the above is
The formula worked perfectly when there were 5 courses, now there are six and I didn't account for that. Without having to change
to
Can I use offset or
somehow?
Thank you
I need some assistance with incorporating last column into a formula.
The output is -
=IF(J31=0,"-",COUNTIFS(Report!$C$2:$C$1106,C31,Report!$H$2:$H$1106,"Specialist",Report!$N$2:$N$1106,3))
My trouble is that column N can move depending on the number of courses available to be completed.
The VB code for the above is
VBA Code:
Set area = Sheets("Report").Range("A2:A" & Sheets("Report").Range("A" & Rows.Count).End(xlUp).Row)
Set subarea = Sheets("Report").Range("B2:B" & Sheets("Report").Range("A" & Rows.Count).End(xlUp).Row)
Set code = Sheets("Report").Range("C2:C" & Sheets("Report").Range("A" & Rows.Count).End(xlUp).Row)
Set job = Sheets("Report").Range("H2:H" & Sheets("Report").Range("A" & Rows.Count).End(xlUp).Row)
Set total = Sheets("Report").Range("N2:N" & Sheets("Report").Range("A" & Rows.Count).End(xlUp).Row) ' total is what can move depending on the total number of courses
Range("F2") = "=if(b2="""",countifs(" & area.Address(external:=True) & ",A2," & job.Address(external:=True) & ",""<>Specialist"")-countifs(" & area.Address(external:=True) & ",A2," & job.Address(external:=True) & ",""<>Specialist""," & total.Address(external:=True) & ","">0""),countifs(" & subarea.Address(external:=True) & ",B2," & job.Address(external:=True) & ",""<>Specialist"")-countifs(" & subarea.Address(external:=True) & ",B2," & job.Address(external:=True) & ",""<>Specialist""," & total.Address(external:=True) & ","">0""))"
Has_Has_Not_Taken_Report_04202022.xlsx.xls | |||||||||
---|---|---|---|---|---|---|---|---|---|
I | J | K | L | M | N | O | |||
1 | 619155M5B | 619155M6B | 619155M7B | 619156B | 619158B | VCIWB01SSFIA22 | Total | ||
2 | 1 | 1 | 1 | 1 | 1 | 1 | 6 | ||
Report |
Cell Formulas | ||
---|---|---|
Range | Formula | |
I2 | I2 | =COUNTIFS(Sheet0!$H$4:$H$6633,G2,Sheet0!$A$4:$A$6633,Report!$I$1,Sheet0!$D$4:$D$6633,"Completed") |
J2 | J2 | =COUNTIFS(Sheet0!$H$4:$H$6633,G2,Sheet0!$A$4:$A$6633,Report!$J$1,Sheet0!$D$4:$D$6633,"Completed") |
K2 | K2 | =COUNTIFS(Sheet0!$H$4:$H$6633,G2,Sheet0!$A$4:$A$6633,Report!$K$1,Sheet0!$D$4:$D$6633,"Completed") |
L2 | L2 | =COUNTIFS(Sheet0!$H$4:$H$6633,G2,Sheet0!$A$4:$A$6633,Report!$L$1,Sheet0!$D$4:$D$6633,"Completed") |
M2 | M2 | =COUNTIFS(Sheet0!$H$4:$H$6633,G2,Sheet0!$A$4:$A$6633,Report!$M$1,Sheet0!$D$4:$D$6633,"Completed") |
N2 | N2 | =COUNTIFS(Sheet0!$H$4:$H$6633,G2,Sheet0!$A$4:$A$6633,Report!$N$1,Sheet0!$D$4:$D$6633,"Completed") |
O2 | O2 | =SUM(I2:N2) |
The formula worked perfectly when there were 5 courses, now there are six and I didn't account for that. Without having to change
VBA Code:
Set total = Sheets("Report").Range("N2:N" & Sheets("Report").Range("A" & Rows.Count).End(xlUp).Row)
VBA Code:
Set total = Sheets("Report").Range("O2:O" & Sheets("Report").Range("A" & Rows.Count).End(xlUp).Row) ' total is what can move depending on the total number of courses
Can I use offset or
VBA Code:
lc = Range("I2").End(xlToRight)
Thank you