+ Reply to Thread
Results 1 to 4 of 4

Adapting an IF formula..

  1. #1
    Registered User
    Join Date
    10-12-2011
    Location
    Bangor
    MS-Off Ver
    Excel 2003
    Posts
    12

    Adapting an IF formula..

    Hello, the following formula works just fine

    =SUM(Sheet1!B5:F5,IF(Sheet1!B6="S",-6,0),IF(Sheet1!C6="S",-7.5,0),IF(Sheet1!D6="S",-7.5,0),IF(Sheet1!E6="S",-7.5,0),IF(Sheet1!F6="S",-7.5,0),IF(Sheet1!B6="UH",-6))

    But can anyone tell me how I can adapt it so that it is either "S" or "H" that will produce the same result..

    Many thanks in advance..
    Last edited by Guygettinby; 10-17-2011 at 04:14 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    45,139

    Re: Adapting an IF formula..

    ...IF(OR(Sheet1!B6="H",Sheet1!B6="S"),-6,0),...


    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Adapting an IF formula..

    You can use OR like this

    =SUM(Sheet1!B5:F5,IF(OR(Sheet1!B6={"S";"H"}),-6,0),IF(OR(Sheet1!C6={"S";"H"}),-7.5,0),IF(OR(Sheet1!D6={"S";"H"}),-7.5,0),IF(OR(Sheet1!E6={"S";"H"}),-7.5,0),IF(OR(Sheet1!F6={"S";"H"}),-7.5,0),IF(Sheet1!B6="UH",-6))
    Audere est facere

  4. #4
    Registered User
    Join Date
    10-12-2011
    Location
    Bangor
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Adapting an IF formula..

    Amazing, thank you ever so much..

+ 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