Originally Posted by
clayton
I am adding totals for multiple products for 3 shifts.
In cells CY7, DA7, DC7, DE7, DG7, DI7, DK7, DM7, DO7, AND DQ7 are the shift indicators which will either have 1, 2, 3 or "" in them.
If there is say a 1 in cell CY7 then CY8 will be added to first shifts total for that product. If its a 2 then it will be added to the 2nd shifts total.
I've tried several methods but because the cells are not adacent I can't get anything to work. Any Ideas?
Hi,
For the range CY to CR - one possibility is a UD Function,
ie, in the cell requiring the totals, put
=CountCY(1)
=CountCY(2)
=CountCY(3)
etc
then copy the code to a Module
(rightmouse the worksheet tab, select 'View Code'
Insert, Module,
Paste this code there
Option Explicit
Function CountCY(MyType As Integer)
Dim MyTotal As Variant
Dim iRow As Integer, iColumn As Integer
MyTotal = 0
iRow = ActiveCell.Row
For iColumn = 103 To 121 Step 2
If Cells(iRow, iColumn).Value = MyType Then MyTotal = MyTotal + Cells(iRow, iColumn + 1).Value
Next iColumn
CountCY = MyTotal
End Function
and let me know how you go
note, the entry must be on the same row as the figures.
---
Bookmarks