Hi Experts,
I have been working for hours on this and have had no luck in getting this to write to the Excel file. I have included the code below and what the formula should be looking like in the Excel file. Any help or thoughts would be greatly appreciated. Also, please let me know what else you need from me. The problem is that the formula will not fit on one single line in the VBA editor. I have tried the (" & _) in all different combos.
What the formula should show :=IF((SUMIFS(K13:K39,A13:A39,"D",J13:J39,"H")-SUMIFS(K13:K39,A13:A39,"D",J13:J39,"S"))<0,(SUMIFS(K13:K39,A13:A39,"D",J13:J39,"H")-SUMIFS(K13:K39,A13:A39,"D",J13:J39,"S")*-1),(SUMIFS(K13:K39,A13:A39,"D",J13:J39,"H")-SUMIFS(K13:K39,A13:A39,"D",J13:J39,"S")))
I have been working for hours on this and have had no luck in getting this to write to the Excel file. I have included the code below and what the formula should be looking like in the Excel file. Any help or thoughts would be greatly appreciated. Also, please let me know what else you need from me. The problem is that the formula will not fit on one single line in the VBA editor. I have tried the (" & _) in all different combos.
Code:
Cells(j, i).Formula = "=IF((SUMIFS(" & Cells(StartRow, "K").Address & ":" & Cells(j - 1, i).Address & "," & Cells(StartRow, "A").Address & ":" & Cells(j - 1, "A").Address & ",""D""," & Cells(StartRow, "J").Address & ":" & Cells(j - 1, "J").Address & ",""H"")-SUMIFS(" & Cells(StartRow, "K").Address & ":" & Cells(j - 1, i).Address & "," & Cells(StartRow, "A").Address & ":" & Cells(j - 1, "A").Address & ",""D""," & Cells(StartRow, "J").Address & ":" & Cells(j - 1, "J").Address & ",""S""))<0,SUMIFS(" & Cells(StartRow, "K").Address & ":" & Cells(j - 1, i).Address & "," & Cells(StartRow, "A").Address & ":" & Cells(j - 1, "A").Address & ",""D""," & Cells(StartRow, "J").Address & ":" & Cells(j - 1, "J").Address & ",""H"")-SUMIFS(" & Cells(StartRow, "K").Address & ":" & Cells(j - 1, i).Address & "," & Cells(StartRow, "A").Address & ":" & Cells(j - 1, "A").Address & ",""D""," & Cells(StartRow, "J").Address & ":" & Cells(j - 1, "J").Address & ",""S"")*-1)," _ & "(SUMIFS(" & Cells(StartRow, "K").Address & ":" & Cells(j - 1, i).Address & "," & Cells(StartRow, "A").Address & ":" & Cells(j - 1, "A").Address & ",""D""," & Cells(StartRow, "J").Address & ":" & Cells(j - 1, "J").Address & ",""H"")-SUMIFS(" & Cells(StartRow, "K").Address & ":" & Cells(j - 1, i).Address & "," & Cells(StartRow, "A").Address & ":" & Cells(j - 1, "A").Address & ",""D""," & Cells(StartRow, "J").Address & ":" & Cells(j - 1, "J").Address & ",""S"")))"
What the formula should show :=IF((SUMIFS(K13:K39,A13:A39,"D",J13:J39,"H")-SUMIFS(K13:K39,A13:A39,"D",J13:J39,"S"))<0,(SUMIFS(K13:K39,A13:A39,"D",J13:J39,"H")-SUMIFS(K13:K39,A13:A39,"D",J13:J39,"S")*-1),(SUMIFS(K13:K39,A13:A39,"D",J13:J39,"H")-SUMIFS(K13:K39,A13:A39,"D",J13:J39,"S")))