+ Reply to Thread
Results 1 to 5 of 5

sum with if statement

  1. #1
    Registered User
    Join Date
    10-18-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    25

    sum with if statement

    If I have some columns and I want to work out a percentage but I need an if statement based on a text response in a column how would i go about this?

    so basically

    if cell a2 = dave and b2 = accept then divide c2/d2*100 and I want this to run on every row in the colum so a2:a132 etc

  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
    44,588

    Re: sum with if statement

    if cell a2 = dave and b2 = accept then divide c2/d2*100 and I want this to run on every row in the colum so a2:a132 etc

    =IF(AND(A2="dave",B2="accept"),C2/D2*100"",)

    And copy down to row 132. The cell references will auto-adjust.

    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
    Registered User
    Join Date
    10-18-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: sum with if statement

    sorry I should have said, the date cells i.e a2 are in a diff worksheet, will it still work?

  4. #4
    Registered User
    Join Date
    10-18-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: sum with if statement

    also I want the answer in one cell so is it possible to using the example before do something like

    =IF(AND('data'!A2:a132="dave",'data'!B2:b132="accept"),'data'!C2/'data'!D2*100"",)

    I have tried this but it doesn't work

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

    Re: sum with if statement

    You could use SUMPRODUCT like this


    =SUMPRODUCT(('data'!A2:A132="dave")*('data'!B2:B132="accept"),'data'!C2:C132/'data'!D2:D132)*100
    Audere est facere

+ 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