espenskeie
Well-known Member
- Joined
- Mar 30, 2009
- Messages
- 636
- Office Version
- 2016
- Platform
- Windows
Hi
I try to past an Array Formula into one single cell, but the code stops at that line and I really cannot find the error. This is my formula:
' Formula for calculating number of days in interest period...
.Range("I4").FormulaArray = "=IF($N$1=360,IF(C4<>0,C4-INDIRECT(""C"" & MAX(IF($C$2:C3<>0,ROW($C$2:C3)))),0),IF(C4<>0,(YEAR(C4)-YEAR(INDIRECT(""C"" & MAX(IF($C$2:C3<>0,ROW($C$2:C3))))))*360+(MONTH(C4)-MONTH(INDIRECT(""C"" & MAX(IF($C$2:C3<>0,ROW($C$2:C3))))))*30+(DAY(C4)-DAY(INDIRECT(""C"" & MAX(IF($C$2:C3<>0,ROW($C$2:C3)))))),0))"
In column C I have dates in C2, and the NeXT is in C8, the one between are empty, so my expected value for I4 would be 0. And then I would autofill this formula to get the number of days from previuos date to current date.
Any suggestion to what is wrong?
Br Espen
I try to past an Array Formula into one single cell, but the code stops at that line and I really cannot find the error. This is my formula:
' Formula for calculating number of days in interest period...
.Range("I4").FormulaArray = "=IF($N$1=360,IF(C4<>0,C4-INDIRECT(""C"" & MAX(IF($C$2:C3<>0,ROW($C$2:C3)))),0),IF(C4<>0,(YEAR(C4)-YEAR(INDIRECT(""C"" & MAX(IF($C$2:C3<>0,ROW($C$2:C3))))))*360+(MONTH(C4)-MONTH(INDIRECT(""C"" & MAX(IF($C$2:C3<>0,ROW($C$2:C3))))))*30+(DAY(C4)-DAY(INDIRECT(""C"" & MAX(IF($C$2:C3<>0,ROW($C$2:C3)))))),0))"
In column C I have dates in C2, and the NeXT is in C8, the one between are empty, so my expected value for I4 would be 0. And then I would autofill this formula to get the number of days from previuos date to current date.
Any suggestion to what is wrong?
Br Espen