View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Compare & sum previous month production by workday.

Try this macro, I have assumed you have the values in ColA. Please change as
required. If you are new to macros; set the Security level to low/medium in
(Tools|Macro|Security). 'Launch VBE using short-key Alt+F11. Insert a module
and paste the below code. Save. Get back to Workbook. Tools|Macro|Run Macro

Sub InsertBlanksAfter100()

Dim intTotal As Integer
Dim lngRow As Long
Dim lngLastRow As Long

lngLastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

For lngRow = lngLastRow To 1 Step -1
If intTotal = 100 Then
ActiveSheet.Rows(lngRow + 1).Insert
intTotal = 0
End If
intTotal = intTotal + Range("A" & lngRow)
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Cindy" wrote:

I need a formula to compare the pound production of the current month, by
workdays, with the previous month. I have turned sumif and countif every way
I can and still can't get it to give me right total pounds.

To complicate the problem, the spreadsheet has the days across the rows with
a column for hours next to each day and then a week to date total at the end
of each week.

I have Excel 2007.

Ex.
Monday 2/3 Tuesday 2/4 Wednesday 2/5 Thursday 2/6 Friday 2/7 WeektoDate
Pounds Hours Pounds Hours Pounds Hours Pounds Hours Pounds Hours Pounds

11111 6.5 22222 7.0 33333 7.0 44444 7.0 55555 6.5
166665

There is then a column with the Month to date total. I have added a column
after that and want it to show the matching workdays amounts. Meaning, if I
have only 13 days of production so far this month I want the total of the
first 13 days of production in the previous month. Both months are in the
same workbook.