I've been trying to come up with either a formula or vba to fill in maximum values from an input sheet into a monthly income statement style sheet(budget sheet). I have the dates on my budget sheet running along row 3. Below I have constant income and expenses but also cells I need to fill in with variable costs. On my input sheet I have daily date values in column B and I record daily values for variable costs such as leisure, food, and gas on the columns to the right. I want to pull the maximum number each month because that will always give me the highest total even if there were not expenses up until the end of the month. I've tried this formula for May's gas expense =IF("H3"=DATE(YEAR(InputSheet!B:B),MONTH(InputSheet!B:B),DAY("")), MAX(InputSheet!D:D), "") but got a value error and most likely have the syntax wrong.
I also tried to mod vba based on code that someone helped me with for my input sheet but can't get that to work either
I'm new to vba and advanced formulas but eager to learn new techniques and appreciate any suggestions and help that the board might provide. I didn't see a place to upload the sheet but that would prob make it easier to understand... Thanks, Michael
I also tried to mod vba based on code that someone helped me with for my input sheet but can't get that to work either
Code:
Sub MaxTotalsToBudget()
Dim x As Long
Application.ScreenUpdating = False
x = Range([D3], Cells(Columns.Count, "D").End(x1Left).Find(Year("InputSheet!B"), Month("InputSheet!B"), x1Values, x1Whole))
With Cells(WorksheetFunction.Match(Range("InputSheet!B")), Range(x), 0)
.Offset(6, 0) = .Offset(6, 0) + Application.Max("InputSheet!D")
.Offset(10, 0) = .Offset(10, 0) + Application.Max("InputSheet!F")
.Offset(15, 0) = .Offset(15, 0) + Application.Max("InputSheet!H")
End With
Application.ScreenUpdating = True
End Sub
I'm new to vba and advanced formulas but eager to learn new techniques and appreciate any suggestions and help that the board might provide. I didn't see a place to upload the sheet but that would prob make it easier to understand... Thanks, Michael