VBA Smaller Code

ziad alsayed

Well-known Member
Joined
Jul 17, 2010
Messages
665
dear all

i am using the below code and it is working fine, i just need to reduce it
appreciate any Help

Code:
Sub Preparereport()
'PHC Branch
    'Confirmed
If Cells(1, 1) = "DecemberP" Then
Cells(4, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(4, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(4, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(4, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(4, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(4, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(4, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(4, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(4, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(4, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(4, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(4, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(4, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(4, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(4, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(4, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(4, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(4, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(4, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(4, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(4, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(4, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(4, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(4, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(4, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(4, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(4, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(4, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(4, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(4, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(4, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(4, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(4, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(4, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(4, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(4, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(4, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(4, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(4, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(4, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(4, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(4, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(4, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(4, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(4, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(4, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(4, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(4, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(4, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(4, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(4, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(4, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(4, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(4, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(4, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(4, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(4, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(4, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(4, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(4, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(4, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(4, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(4, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "January" Then
Cells(5, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(5, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(5, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(5, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(5, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(5, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(5, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(5, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(5, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(5, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(5, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(5, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(5, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(5, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(5, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(5, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(5, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(5, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(5, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(5, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(5, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(5, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(5, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(5, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(5, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(5, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(5, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(5, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(5, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(5, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(5, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(5, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(5, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(5, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(5, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(5, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(5, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(5, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(5, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(5, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(5, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(5, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(5, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(5, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(5, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(5, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(5, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(5, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(5, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(5, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(5, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(5, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(5, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(5, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(5, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(5, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(5, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(5, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(5, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(5, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(5, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(5, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(5, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "February" Then
Cells(6, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(6, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(6, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(6, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(6, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(6, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(6, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(6, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(6, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(6, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(6, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(6, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(6, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(6, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(6, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(6, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(6, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(6, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(6, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(6, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(6, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(5, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(5, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(5, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(6, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(6, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(6, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(6, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(6, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(6, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(6, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(6, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(6, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(6, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(6, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(6, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(6, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(6, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(6, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(6, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(6, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(6, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(6, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(6, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(6, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(6, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(6, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(6, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(6, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(6, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(6, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(6, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(6, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(6, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(6, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(6, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(6, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(6, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(6, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(6, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(6, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(6, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(6, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "March" Then
Cells(7, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(7, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(7, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(7, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(7, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(7, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(7, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(7, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(7, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(7, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(7, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(7, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(7, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(7, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(7, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(7, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(7, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(7, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(7, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(7, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(7, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(7, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(7, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(7, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(7, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(7, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(7, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(7, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(7, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(7, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(7, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(7, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(7, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(7, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(7, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(7, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(7, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(7, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(7, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(7, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(7, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(7, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(7, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(7, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(7, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(7, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(7, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(7, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(7, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(7, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(7, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(7, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(7, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(7, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(7, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(7, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(7, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(7, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(7, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(7, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(7, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(7, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(7, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "April" Then
Cells(8, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(8, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(8, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(8, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(8, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(8, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(8, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(8, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(8, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(8, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(8, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(8, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(8, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(8, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(8, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(8, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(8, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(8, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(8, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(8, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(8, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(8, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(8, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(8, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(8, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(8, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(8, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(8, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(8, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(8, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(8, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(8, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(8, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(8, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(8, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(8, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(8, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(8, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(8, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(8, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(8, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(8, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(8, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(8, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(8, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(8, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(8, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(8, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(8, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(8, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(8, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(8, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(8, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(8, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(8, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(8, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(8, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(8, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(8, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(8, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(8, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(8, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(8, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "May" Then
Cells(9, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(9, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(9, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(9, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(9, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(9, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(9, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(9, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(9, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(9, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(9, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(9, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(9, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(9, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(9, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(9, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(9, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(9, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(9, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(9, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(9, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(9, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(9, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(9, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(9, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(9, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(9, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(9, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(9, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(9, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(9, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(9, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(9, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(9, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(9, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(9, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(9, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(9, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(9, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(9, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(9, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(9, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(9, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(9, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(9, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(9, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(9, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(9, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(9, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(9, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(9, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(9, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(9, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(9, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(9, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(9, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(9, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(9, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(9, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(9, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(9, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(9, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(9, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "June" Then
Cells(10, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(10, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(10, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(10, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(10, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(10, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(10, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(10, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(10, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(10, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(10, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(10, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(10, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(10, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(10, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(10, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(10, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(10, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(10, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(10, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(10, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(10, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(10, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(10, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(10, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(10, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(10, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(10, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(10, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(10, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(10, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(10, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(10, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(10, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(10, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(10, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(10, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(10, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(10, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(10, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(10, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(10, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(10, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(10, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(10, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(10, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(10, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(10, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(10, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(10, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(10, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(10, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(10, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(10, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(10, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(10, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(10, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(10, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(10, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(10, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(10, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(10, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(10, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "July" Then
Cells(11, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(11, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(11, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(11, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(11, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(11, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(11, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(11, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(11, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(11, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(11, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(11, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(11, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(11, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(11, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(11, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(11, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(11, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(11, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(11, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(11, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(11, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(11, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(11, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(11, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(11, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(11, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(11, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(11, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(11, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(11, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(11, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(11, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(11, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(11, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(11, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(11, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(11, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(11, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(11, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(11, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(11, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(11, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(11, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(11, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(11, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(11, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(11, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(11, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(11, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(11, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(11, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(11, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(11, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(11, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(11, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(11, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(11, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(11, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(11, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(11, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(11, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(11, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "August" Then
Cells(12, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(12, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(12, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(12, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(12, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(12, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(12, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(12, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(12, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(12, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(12, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(12, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(12, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(12, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(12, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(12, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(12, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(12, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(12, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(12, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(12, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(12, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(12, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(12, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(12, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(12, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(12, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(12, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(12, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(12, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(12, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(12, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(12, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(12, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(12, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(12, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(12, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(12, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(12, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(12, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(12, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(12, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(12, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(12, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(12, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(12, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(12, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(12, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(12, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(12, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(12, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(12, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(12, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(12, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(12, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(12, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(12, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(12, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(12, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(12, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(12, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(12, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(12, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "September" Then
Cells(13, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(13, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(13, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(13, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(13, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(13, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(13, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(13, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(13, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(13, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(13, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(13, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(13, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(13, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(13, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(13, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(13, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(13, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(13, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(13, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(13, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(13, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(13, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(13, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(13, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(13, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(13, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(13, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(13, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(13, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(13, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(13, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(13, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(13, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(13, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(13, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(13, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(13, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(13, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(13, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(13, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(13, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(13, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(13, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(13, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(13, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(13, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(13, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(13, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(13, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(13, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(13, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(13, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(13, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(13, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(13, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(13, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(13, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(13, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(13, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(13, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(13, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(13, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "October" Then
Cells(14, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(14, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(14, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(14, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(14, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(14, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(14, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(14, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(14, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(14, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(14, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(14, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(14, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(14, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(14, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(14, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(14, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(14, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(14, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(14, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(14, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(14, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(14, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(14, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(14, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(14, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(14, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(14, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(14, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(14, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(14, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(14, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(14, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(14, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(14, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(14, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(14, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(14, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(14, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(14, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(14, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(14, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(14, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(14, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(14, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(14, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(14, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(14, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(14, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(14, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(14, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(14, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(14, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(14, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(14, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(14, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(14, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(14, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(14, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(14, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(14, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(14, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(14, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "November" Then
Cells(15, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(15, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(15, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(15, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(15, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(15, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(15, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(15, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(15, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(15, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(15, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(15, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(15, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(15, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(15, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(15, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(15, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(15, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(15, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(15, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(15, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(15, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(15, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(15, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(15, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(15, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(15, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(15, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(15, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(15, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(15, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(15, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(15, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(15, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(15, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(15, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(15, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(15, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(15, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(15, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(15, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(15, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(15, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(15, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(15, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(15, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(15, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(15, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(15, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(15, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(15, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(15, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(15, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(15, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(15, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(15, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(15, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(15, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(15, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(15, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(15, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(15, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(15, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
ElseIf Cells(1, 1) = "December" Then
Cells(16, 2).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[4],PH,Total!C[7],Confirmed)"
Cells(16, 3).FormulaR1C1 = "=SUMIFS(Total!C[5],Total!C[3],PH,Total!C[6],Confirmed)"
Cells(16, 4).FormulaR1C1 = "=COUNTIFS(Total!C[2],PH,Total!C[5],Confirmed)"
    'Outsource
Cells(16, 6).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C,PH,Total!C[3],Outsource)"
Cells(16, 7).FormulaR1C1 = "=SUMIFS(Total!C[1],Total!C[-1],PH,Total!C[2],Outsource)"
Cells(16, 8).FormulaR1C1 = "=COUNTIFS(Total!C[-2],PH,Total!C[1],Outsource)"
    'Casual
Cells(16, 10).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-4],PH,Total!C[-1],Casual)"
Cells(16, 11).FormulaR1C1 = "=SUMIFS(Total!C[-3],Total!C[-5],PH,Total!C[-2],Casual)"
Cells(16, 12).FormulaR1C1 = "=COUNTIFS(Total!C[-6],PH,Total!C[-3],Casual)"
'Apapa branch
    'Confirmed
Cells(16, 14).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(16, 15).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Confirmed)"
Cells(16, 16).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Confirmed)"
    'Outsource
Cells(16, 18).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Outsource)"
Cells(16, 19).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Apapa,Total!C9,Outsource)"
Cells(16, 20).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Outsource)"
    'Casual
Cells(16, 22).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Apapa,Total!C9,Casual)"
Cells(16, 23).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,PH,Total!C9,Casual)"
Cells(16, 24).FormulaR1C1 = "=COUNTIFS(Total!C6,Apapa,Total!C9,Casual)"
'VI Branch
    'Confirmed
Cells(16, 26).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Confirmed)"
Cells(16, 27).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Confirmed)"
Cells(16, 28).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Confirmed)"
    'Outsource
Cells(16, 30).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Outsource)"
Cells(16, 31).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Outsource)"
Cells(16, 32).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Outsource)"
    'casual
Cells(16, 34).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,VI,Total!C9,Casual)"
Cells(16, 35).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,VI,Total!C9,Casual)"
Cells(16, 36).FormulaR1C1 = "=COUNTIFS(Total!C6,VI,Total!C9,Casual)"
'Kano Branch
    'Confirmed
Cells(16, 38).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Confirmed)"
Cells(16, 39).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(16, 40).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Confirmed)"
    'Outsource
Cells(16, 42).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Outsource)"
Cells(16, 43).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Outsource)"
Cells(16, 44).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Outsource)"
    'casual
Cells(16, 46).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Kano,Total!C9,Casual)"
Cells(16, 47).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Kano,Total!C9,Confirmed)"
Cells(16, 48).FormulaR1C1 = "=COUNTIFS(Total!C6,Kano,Total!C9,Casual)"
'Ikeja barnch
    'Confirmed
Cells(16, 50).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(16, 51).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Confirmed)"
Cells(16, 52).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Confirmed)"
    'Outsource
Cells(16, 54).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(16, 55).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Outsource)"
Cells(16, 56).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Outsource)"
    'Casual
Cells(16, 58).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Ikeja,Total!C9,Casual)"
Cells(16, 59).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Ikeja,Total!C9,Casual)"
Cells(16, 60).FormulaR1C1 = "=COUNTIFS(Total!C6,Ikeja,Total!C9,Casual)"
'Fabrication Branch
    'Confirmed
Cells(16, 62).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(16, 63).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Confirmed)"
Cells(16, 64).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Confirmed)"
    'Outsource
Cells(16, 66).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(16, 67).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Outsource)"
Cells(16, 68).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Outsource)"
    'Casual
Cells(16, 70).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Fabrication,Total!C9,Casual)"
Cells(16, 71).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Fabrication,Total!C9,Casual)"
Cells(16, 72).FormulaR1C1 = "=COUNTIFS(Total!C6,Fabrication,Total!C9,Casual)"
'Assembly branch
    'Confirmed
Cells(16, 74).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(16, 75).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Confirmed)"
Cells(16, 76).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Confirmed)"
    'OutSource
Cells(16, 78).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Outsource)"
Cells(16, 79).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Outsource)"
Cells(16, 80).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Outsource)"
    'Casual
Cells(16, 82).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6,Assembly,Total!C9,Casual)"
Cells(16, 83).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6,Assembly,Total!C9,Casual)"
Cells(16, 84).FormulaR1C1 = "=COUNTIFS(Total!C6,Assembly,Total!C9,Casual)"
End If

End Sub


thanks in advance
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Took me a minute to find the consistency in the code, but I believe this will do the trick for you:

Code:
Sub Preparereport()
Dim MonthArray  As Variant, _
    wsArray     As Variant, _
    nameArray   As Variant, _
    i           As Long, _
    xCol        As Variant
 
' Variable Initialization
MonthArray = Array("DecemberP", "January", "February", "March", "April", "May", "June", _
                   "July", "August", "September", "October", "November", "December")
wsArray = Array("PH", "Apapa", "VI", "Kano", "Ikeja", "Fabrication", "Assembly")
nameArray = Array("Confirmed", "Outsource", "Casual")
 
Application.ScreenUpdating = False

xCol = Application.Match(Cells(1, 1).Value, MonthArray, 0)

If Not IsError(xCol) Then
    For i = 2 To 84 Step 4
        Cells(3 + xCol, i).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int((i - 1) / 4) Mod 3) & ")"
        Cells(3 + xCol, i + 1).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int((i - 1) / 4) Mod 3) & ")"
        Cells(3 + xCol, i + 2).FormulaR1C1 = "=COUNTIFS(Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int((i - 1) / 4) Mod 3) & ")"
    Next i
Else
    MsgBox "Cell A1 does not contain a valid value."
End If

Application.ScreenUpdating = True

End Sub
 
Upvote 0
dear MrKowz

hope everything is ok. i need your help again please.

the below code you sent me is working fine, now i have to do some amendement
in the namaArray i nee to add a name , which is "Speakwell" , i will add it after the "Outsource" and before the "casual"

after adding the columns of "speakwell" the loop should be from i =2 to 96
the problem i am facing is that code is data are not working again. hope you can assist.

Code:
Public Sub Preparereport2()
Dim MonthArray  As Variant, _
    wsArray     As Variant, _
    nameArray   As Variant, _
    i           As Long, _
    xCol        As Variant
    
' Variable Initialization
MonthArray = Array("DecemberP", "January", "February", "March", "April", "May", "June", _
                   "July", "August", "September", "October", "November", "December")
wsArray = Array("PH", "Apapa", "VI", "Kano", "Ikeja", "Assembly")
nameArray = Array("Confirmed", "Outsource", "Speakwell", "Casual")
 
Application.ScreenUpdating = False
xCol = Application.Match(Cells(1, 1).Value, MonthArray, 0)
If Not IsError(xCol) Then
    For i = 2 To 96 Step 4
        Cells(3 + xCol, i).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int((i - 1) / 4) Mod 3) & ")"
        Cells(3 + xCol, i).Select
        With Selection
        .Value = .Value
        End With
        Cells(3 + xCol, i + 1).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int((i - 1) / 4) Mod 3) & ")"
        Cells(3 + xCol, i + 1).Select
        With Selection
        .Value = .Value
        End With
        Cells(3 + xCol, i + 2).FormulaR1C1 = "=COUNTIFS(Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int((i - 1) / 4) Mod 3) & ")"
        Cells(3 + xCol, i + 2).Select
        With Selection
        .Value = .Value
        End With
    Next i
Else
    MsgBox "Cell A1 does not contain a valid value."
End If
Application.ScreenUpdating = True
End Sub
 
Upvote 0
I haven't had my coffee yet this morning, but give this a shot:

Code:
Public Sub Preparereport2()
Dim MonthArray  As Variant, _
    wsArray     As Variant, _
    nameArray   As Variant, _
    i           As Long, _
    xCol        As Variant
    
' Variable Initialization
MonthArray = Array("DecemberP", "January", "February", "March", "April", "May", "June", _
                   "July", "August", "September", "October", "November", "December")
wsArray = Array("PH", "Apapa", "VI", "Kano", "Ikeja", "Assembly")
nameArray = Array("Confirmed", "Outsource", "Speakwell", "Casual")
 
Application.ScreenUpdating = False
xCol = Application.Match(Cells(1, 1).Value, MonthArray, 0)
If Not IsError(xCol) Then
    For i = 2 To 96 Step 4
        Cells(3 + xCol, i).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int(i / 3) Mod 4) & ")"
        With Cells(3 + xCol, i)
            .Value = .Value
        End With
        Cells(3 + xCol, i + 1).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int(i / 3) Mod 4) & ")"
        With Cells(3 + xCol, i + 1)
            .Value = .Value
        End With
        Cells(3 + xCol, i + 2).FormulaR1C1 = "=COUNTIFS(Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int(i / 3) Mod 4) & ")"
        With Cells(3 + xCol, i + 2)
            .Value = .Value
        End With
    Next i
Else
    MsgBox "Cell A1 does not contain a valid value."
End If
Application.ScreenUpdating = True
End Sub
 
Upvote 0
good morning , enjoy your coffee :), it is afternoon here:)
still not giving the desired result, i am getting the result of Speakwell in outsource and the result of casual in speakwell and so on....

please sort out on your free time.

i have a meeting now , see you later.

thanks again.
 
Upvote 0
Try:

Code:
Public Sub Preparereport2()
Dim MonthArray  As Variant, _
    wsArray     As Variant, _
    nameArray   As Variant, _
    i           As Long, _
    xCol        As Variant
    
' Variable Initialization
MonthArray = Array("DecemberP", "January", "February", "March", "April", "May", "June", _
                   "July", "August", "September", "October", "November", "December")
wsArray = Array("PH", "Apapa", "VI", "Kano", "Ikeja", "Assembly")
nameArray = Array("Confirmed", "Outsource", "Speakwell", "Casual")
 
Application.ScreenUpdating = False
xCol = Application.Match(Cells(1, 1).Value, MonthArray, 0)
If Not IsError(xCol) Then
    For i = 2 To 96 Step 4
        Cells(3 + xCol, i).FormulaR1C1 = "=SUMIFS(Total!C7,Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int((i - 1) / 4) Mod 4) & ")"
        With Cells(3 + xCol, i)
            .Value = .Value
        End With
        Cells(3 + xCol, i + 1).FormulaR1C1 = "=SUMIFS(Total!C8,Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int((i - 1) / 4) Mod 4) & ")"
        With Cells(3 + xCol, i + 1)
            .Value = .Value
        End With
        Cells(3 + xCol, i + 2).FormulaR1C1 = "=COUNTIFS(Total!C6," & wsArray(Int((i - 1) / 12)) & ",Total!C9," & nameArray(Int((i - 1) / 4) Mod 4) & ")"
        With Cells(3 + xCol, i + 2)
            .Value = .Value
        End With
    Next i
Else
    MsgBox "Cell A1 does not contain a valid value."
End If
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Dear MrKowz

still not working. the problem now is the following

the casual for PH is showing as apapa.
the casual for apapa is showing as VI.

the data for ikeja and Assembly are not showing.
 
Upvote 0
Dear MrKowz it is sorted out the wsarray should divided by 16 instead of 12 for the Integer to work. Take care
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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