+ Reply to Thread
Results 1 to 10 of 10

Summing values from range with if statement

Hybrid View

  1. #1
    Registered User
    Join Date
    10-08-2012
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    26

    Summing values from range with if statement

    Hey all!

    I am new to this forum, because I have been able to solve my problem by my self so far, but now I have met an impossible problem.

    The problem is following:

    I have 31 dates on cells from D7 to D37, lets say for example 1.1-31.1.
    On sheets from E7 to E37 I have amount of hours, i have worked on a current day.

    What I would like to have is a function, which sums all the hours together that have been done on Monday from the range E7:37. I have tried following on a cell: =sumif(D7:D37;WEEKDAY(2);E7:E37).
    I know how I could do it with a fill function and then sum those together, but in that case I would have 32 different cells needed to do the trick.

    Could anyone help me, I am desperate because excel has won me

    Cheers,

    Tuomas/Finland
    Last edited by truohol; 10-09-2012 at 05:06 AM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Summing values from range with if statement

    Well first off, what you have in D7:D37 (1.1-31.1) are not real dates so in the current format does not seem possible.

    Do you want to show a sample Excel file of what you have?
    Last edited by jeffreybrown; 10-08-2012 at 11:30 PM.
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    10-08-2012
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Summing values from range with if statement

    Hey,

    I know that they are not real dates, but this is the only way I knew to get them automatically appear and I do not have to input manually dates and weekdays.
    Here you can see the attachment file, dates are in Finnish but the formulas are in English.

    Hope you get a clue
    Attached Files Attached Files
    Last edited by jeffreybrown; 10-09-2012 at 12:12 AM. Reason: Please do not post whole quotes unless they add to the information...Thanks.

  4. #4
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Summing values from range with if statement

    Well, if you added a helper column with the day of the week next to the dates listed, you could use:
    Formula: copy to clipboard
    =SUMIF($C$7:$C$37,$G7,$E$7:$E$37)

    The days of the week (Monday, Tuesday, etc..) are entered in C7:C37
    The dates (1/1/2013, etc.) are entered in D7:D37
    The hours worked are entered in E7:E37

    See attached sheet for example.

    - Vince
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-08-2012
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Summing values from range with if statement

    Hey,

    This is all most the thing I was looking for. Only problem is, that the days you have written "monday, tuesday.." on C7:C37, I take them from the dates on C8:C38 with custom format DDDD.
    Therefore I can not the same formula than you, where you use days(G8:G13) as reference.

    I use this style, because then it automatically takes right dates and day numbers to all my month sheets(jan to dec).

    So in short, is there a way that I could use the "workday(2), workday(3.." as reference to sum the done hours?

    Sorry for the bad explaining and thanks very much for the super fast reply!

    Brg,

    Tuomas
    Last edited by jeffreybrown; 10-08-2012 at 11:40 PM. Reason: Please do not post whole quotes...Thanks.

  6. #6
    Registered User
    Join Date
    10-08-2012
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Summing values from range with if statement

    Hi!
    Thank you gues for the replies. With you I did manage to get it working as I wanted, now I can start making crazy things with my excel I propably have to get back here again in the future if I have any doubts, so amazingly good replies with fast phase! Thanks once more all, cheers, Tuomas

  7. #7
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Summing values from range with if statement

    Could you upload an example spreadsheet of what you are looking for?

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Summing values from range with if statement

    How about...

    =SUMPRODUCT(--(TEXT($D$7:$D$37,"ddd")="Mon"),$E$7:$E$37)

    Change the day as needed or you can put the day in a cell and reference it...

    =SUMPRODUCT(--(TEXT($D$7:$D$37,"ddd")=$G$1),$E$7:$E$37)

    Note: Sorry about that, if those are the days in M10:M15, then seems Vince has it...
    Last edited by jeffreybrown; 10-09-2012 at 12:21 AM.

  9. #9
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Summing values from range with if statement

    OK, I think I got it... see modified version of your sheet.

    - Vince

    * Note
    - The changes were made on the sheet named 'Helmikuu' which I assume means February in Finnish?
    - I changed the formulas in column C from '=D12' to '=TEXT(D12,"dddd") to get it to function properly.
    - I changed the formulas in column N to '=SUMIF($C$7:$C$37,"Monday",$E$7:$E$37)', changing for each day of the week.
    Attached Files Attached Files
    Last edited by Moo the Dog; 10-09-2012 at 12:34 AM.

  10. #10
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Summing values from range with if statement

    Attached modified sheet to calculate workdays in addition to workhours.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1