Hey everyone,
I have this sample:
<title>Excel Jeanie HTML</title>
What I am trying to do is create a formula for Column D which can be copied down for the rest of the rows.
I will focus on cell D6. I need this cell to show all of the hours worked based on the input of B1. I have a macro that hides columns based on the input of B1 (I.E.- will hide all columns not equal to the entry)
Code for macro (in case it is useful):
What I want is for cell D6 to count the number of hours worked based on the input of B1.
If nothing is entered into B1, it will be the same as the overall Total, but if, say Mod 2 is entered, I want cell D6 to add the hours worked for Labor Category A only for Mod 1 and Mod 2, not the rest of the sheet.
I tried using a nested SUMIF but quickly found out that is not possible. (First to limit what Mods to look at, then another to look at each Hour column). I saw SUMPRODUCT was a popular alternative but I am new to arrays and Excel syntax and have no idea how to write out a formula that will first limit which Mods to look at, then only add those Mods to find the Hours worked.
Could anyone help me out? If I need to reword what I am looking for just let me know.
Thanks,
Dan
I have this sample:
<title>Excel Jeanie HTML</title>
Excel Workbook | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | |||
1 | Input: | |||||||||||||||||
2 | ||||||||||||||||||
3 | ||||||||||||||||||
4 | Test | Selective Total | Mod 1 | Mod 2 | Mod 3 | Total | Total | |||||||||||
5 | Labor | Location | Category | Hour | Value | Hour | Value | Hour | Value | Hour | Value | Hour | Value | Hour | Value | |||
6 | A | MD | Cool | 0 | 0 | 0 | 1 | 10 | 0 | 0 | 1 | 10 | 0 | 0 | ||||
7 | B | MD | Cooler | 0 | 0 | 2 | 20 | 0 | 0 | 2 | 20 | 0 | 0 | |||||
8 | C | CA | Uncool | 0 | 0 | 3 | 30 | 5 | 50 | 8 | 80 | 0 | 0 | |||||
9 | ||||||||||||||||||
10 | ||||||||||||||||||
Sheet1 |
What I am trying to do is create a formula for Column D which can be copied down for the rest of the rows.
I will focus on cell D6. I need this cell to show all of the hours worked based on the input of B1. I have a macro that hides columns based on the input of B1 (I.E.- will hide all columns not equal to the entry)
Code for macro (in case it is useful):
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$1" Then
FilterVal = Range("B1").Text
'Turn off the flicker that's about to happen
Application.ScreenUpdating = False
'Loop Columns to End
For ColIdx = 6 To UsedRange.Columns.Count
If FilterVal = Empty Then
Columns.Hidden = False
'Look for the Column Label of row 6 to match filter
ElseIf Cells(4, ColIdx) = FilterVal Then
'If matched, then unhide it
Columns(ColIdx).Hidden = False
'increment the column index
ColIdx = ColIdx + 1
'Unhide that one too
Columns(ColIdx).Hidden = False
Else 'not the column label we're looking for
'Hide 'em
Columns(ColIdx).Hidden = True
Columns(ColIdx + 1).Hidden = True
End If
Next
'Turn the flicker back on
Application.ScreenUpdating = True
End If
End Sub
What I want is for cell D6 to count the number of hours worked based on the input of B1.
If nothing is entered into B1, it will be the same as the overall Total, but if, say Mod 2 is entered, I want cell D6 to add the hours worked for Labor Category A only for Mod 1 and Mod 2, not the rest of the sheet.
I tried using a nested SUMIF but quickly found out that is not possible. (First to limit what Mods to look at, then another to look at each Hour column). I saw SUMPRODUCT was a popular alternative but I am new to arrays and Excel syntax and have no idea how to write out a formula that will first limit which Mods to look at, then only add those Mods to find the Hours worked.
Could anyone help me out? If I need to reword what I am looking for just let me know.
Thanks,
Dan