Public Function DailyBudgetForecast(L As Integer, C As Integer)
'Dim i As Byte
'Dim FeDataPipe As Worksheet: Set eDataPipe = ThisWorkbook.Worksheets("Data - Pipe")
Dim month1, month2 As Integer
Application.Volatile
sDate = Cells(L, 23)
eeDate = Cells(L, 24)
month1 = Month(Cells(L, 23)) ' Start month extract
month2 = Month(Cells(L, 24)) ' End month extract
If (C - 28) >= month1 And (C - 28) <= month2 Then ' Month segment definition
repart = Day(DateSerial(Year(sDate), Month(sDate) + 1, 0)) - Month(sDate)
DailyBudgetForecast = repart * Round(Cells(L, 22) / (eeDate - sDate + 1), 2) ' Average value distribution
Else
DailyBudgetForecast = ""
End If
If DailyBudgetForecast = "" Then DailyBudgetForecast = ""
End Function