+ Reply to Thread
Results 1 to 7 of 7

Multiple IF Arguments

  1. #1
    Registered User
    Join Date
    12-22-2010
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Multiple IF Arguments

    I’m trying to get Excel to see if a cell contains the word ‘Sunday’ if it does it counts back the days to Sunday and displays the results of a sum. This seems to be working fine, with one or two IF statements, but as soon as I use any more than that I get an error. I need to go back upto 7 days. This is the calculation I was trying to use:

    IF(B33="Sunday",SUM(L34:L34)," ",IF B32="Sunday",SUM(L33:L34)," ",IF B31="Sunday",SUM(L32:L34)," ",IF B30="Sunday",SUM(L31:L34)," ",IF B29="Sunday",SUM(L30:L34)," ",IF B28="Sunday",SUM(L29:L34)," ",IF B27="Sunday",SUM(L28:L34)," ")

    Any help much appreciated.
    Last edited by Chris-TT; 12-31-2010 at 01:36 PM. Reason: Removing "Solved" as I have a further question about this formula

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Help Dealing With Multiple IF Arguments

    Maybe this:

    =SUM(OFFSET(L27, MATCH("Sunday", $B$27:$B$33, 0), ):L34)

    If there is no Sunday you'll get #N/A (meaning, you must type Sunday in range $B$27:$B$33)

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Help Dealing With Multiple IF Arguments

    Does this work for you?

    =SUM(INDEX($L$28:$L$34,MATCH("Sunday",$B$28:$B$34,0)+1):$L$34)

    Just adjust the L28 and B28 to match the top cell of the B range you are looking at.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    12-22-2010
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Help Dealing With Multiple IF Arguments

    Awesome, many thanks zbor, I just tried it and it works a treat!

  5. #5
    Registered User
    Join Date
    12-22-2010
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Multiple IF Arguments

    Just to elaborate a bit further I’m having trouble with one more small thing to do with this formula. I want a “-“ to appear if fields are empty. Now this works fine if the last day of the month is a Sunday, however I’m trying to make it so if the fields are blank it will always show “-“.

    Here is the formula that works but only on the Sunday:

    =IF(B34="Sunday",IF(SUM(L28:L34)=0,"-",SUM(L28:L34)),SUM(OFFSET(L28,MATCH("Sunday",B28:B34,0),):L34))

    And here is what I thought I needed to do to correct the problem, but its saying there are too many arguments:

    =IF(SUM(L28:L34)=0,"-",IF(B34="Sunday",SUM(L28:L34)),SUM(OFFSET(L28,MATCH("Sunday",B28:B34,0),):L34))

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Multiple IF Arguments

    Try:

    =IF(SUM(L28:L34)=0,"-",IF(B34="Sunday",SUM(L28:L34),SUM(OFFSET(L28,MATCH("Sunday",B28:B34,0),):L34)))

  7. #7
    Registered User
    Join Date
    12-22-2010
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Multiple IF Arguments

    Many thanks! [= Works perfectly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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