开发者

Excel: Count billing hours for specific month, week, year

I have four columns in a spreadsheet, Month, Week, Year, Hours and I want to 'sum' the number o开发者_JS百科f hours based on the month, week, and year number. Months would be (1-12), week would be (1-52), and year would be (2009, 2010, 2011)

For example:

Month      Week    Year    Hours    Total_Hours
1           2      2011      8         12
1           2      2011      4         12
1           2      2010      7          7
1           2      2009      5          5

Not sure if I should use vlookup or a nest 'if'. If someone else has a better approach, please let me know.

Thanks in advance.


First, you create another column that is a string concatenation of the first three, and drag down:

=TRIM(A2) & TRIM(B2) & TRIM(C2)

Then, you use this formula for Total_Hours, and drag down:

=SUMIF(D:D, D2, E:E)

My example uses your sample, and inserts a new column D for the concatenation.

End Result:

Month  Week     Year        Concat  Hours      Total_Hours
  1      2      2011        122011    8             12
  1      2      2011        122011    4             12
  1      2      2010        122010    7              7
  1      2      2009        122009    5              5

Of course, I'd use Named Ranges for anything that's likely to change.


If you use VLOOKUP ensure the textual data is formatted correctly or use Text and Data functions

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜