Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the months of a year in a row. In each column I have values (e.g.
$/Jan, $/Feb, $/March). Now I want to write a formula that gives me the sum of the values for the year to date (ie in March give me the sum of the values for Jan, Feb, & March but no others). I use "MONTH(NOW())" to get the current month. How to I get the sum of the values for this variable number of cells (ie it grows from 1 to 12 cell values depending upon the month of the year it is)? thank you |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This will sum row 2 from col A to the column of the month of today=19 IF
March =SUM(A2:INDEX(2:2,MONTH(TODAY()))) you could also use an offset formula jan feb mar 1__10__8 -- Don Guillett Microsoft MVP Excel SalesAid Software "Citizen" wrote in message news:6B5E7EC7-7854-460D-80C8- ... I have the months of a year in a row. In each column I have values (e.g. $/Jan, $/Feb, $/March). Now I want to write a formula that gives me the sum of the values for the year to date (ie in March give me the sum of the values for Jan, Feb, & March but no others). I use "MONTH(NOW())" to get the current month. How to I get the sum of the values for this variable number of cells (ie it grows from 1 to 12 cell values depending upon the month of the year it is)? thank you |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This assumes a headre row and that the months are listed consecutively
beginning in column A. Sub motst() LRow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row x = Month(Now) If x = 2 Then myVal = Application.WorksheetFunction.Sum(Range("B2:B" & LRow)) MsgBox myVal End If End Sub "Citizen" wrote: I have the months of a year in a row. In each column I have values (e.g. $/Jan, $/Feb, $/March). Now I want to write a formula that gives me the sum of the values for the year to date (ie in March give me the sum of the values for Jan, Feb, & March but no others). I use "MONTH(NOW())" to get the current month. How to I get the sum of the values for this variable number of cells (ie it grows from 1 to 12 cell values depending upon the month of the year it is)? thank you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Summing an unkown number of columns | Excel Worksheet Functions | |||
Highlight cells with certain number values | Excel Worksheet Functions | |||
Number of cells that have same values | Excel Discussion (Misc queries) | |||
VBA Pivot Tables with unkown # of rows in the data set | Excel Programming | |||
Passing an unkown range to a function | Excel Programming |