Max of monthly range

mexcel300

New Member
Joined
May 10, 2011
Messages
3
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
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
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

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