SUMIF value exists in table

JoshLyman

New Member
Joined
Jan 11, 2023
Messages
35
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Struggling to figure out what formula to use. I have the below table where users will enter a line, say how many hours they've worked that day, and stipulate which 'KSBs' they've done. For instance on 01/08/2023, they spent 4 hours working on K1 and K2.

Book1
ABCDE
1DateHoursKSB coveredKSB covered2KSB covered3
201/08/20234K1K2
315/08/20236K3
401/09/20233S2K1
504/09/20237S2B1B2
618/09/20235K3S3
Sheet1
Cells with Data Validation
CellAllowCriteria
C2:E6List=$H$2:$H$10


I have a second table which should tell me how many times a given KSB has been recorded, as well as how many hours they've spent working on each one. The first formula is working, but the second isn't. For some reason I cannot get it to calculate the 'hours' column every time a KSB appears in a row. For instance K1 appears twice and should say 7 hours (4 on 01/08/2023 and 3 on 01/09/2023).

Book1
HIJ
1KSBInstancesHours
2K124
3K210
4K3211
5S100
6S2210
7S310
8B110
9B210
10B300
Sheet1
Cell Formulas
RangeFormula
I2:I10I2=COUNTIF(Table1[[KSB covered]:[KSB covered3]],[@KSB])
J2:J10J2=SUMIF(Table1[[KSB covered]:[KSB covered3]],[@KSB],Table1[Hours])


Any advice will be greatly received!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
How about
Excel Formula:
=sumproduct((Table1[[KSB covered]:[KSB covered3]]=[@KSB])*(Table1[Hours]))
 
Upvote 1
Solution
Magic. Thanks @Fluff! I'd tried SUMPRODUCT but I was apparently missing a few important parentheses!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,963
Members
449,094
Latest member
Anshu121

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