+ Reply to Thread
Results 1 to 13 of 13

Countif down a column with multiple ifs

  1. #1
    Registered User
    Join Date
    01-18-2016
    Location
    Victoria, BC Canada
    MS-Off Ver
    2010
    Posts
    5

    Countif down a column with multiple ifs

    Not sure if title is concise but.....

    What I want is a formula to go down a column and countif

    "vacation" then *7.5hours and also to countif "Vacation",2 (if only the word vacation is there then *7.5 and if vacation is followed by a different number then add that number so that the following would be totaled into one cell

    Example

    Cell 1 = Vacation
    Cell 2 = Vacation,2

    The total would be 9.5 (7.5hours for cell 1 and 2 hours for cell 2)

    Thank you in advance for any help I can get on this.

    Lori

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,366

    Re: Countif down a column with multiple ifs

    I assume the cells are in a row e.g A1,B1 with sum in C1?

    or is it a total sum for multiple rows

    be totaled into one cell
    Last edited by JohnTopley; 01-18-2016 at 03:15 PM.

  3. #3
    Registered User
    Join Date
    01-18-2016
    Location
    Victoria, BC Canada
    MS-Off Ver
    2010
    Posts
    5

    Re: Countif down a column with multiple ifs

    I want the formula to count down a column. Like B25: B389. Then I can copy the formula across the rows that contain my employees

    Joe Mary Ralph
    January
    1 Vacation
    2 Vacation,2
    3
    February
    1
    2
    3
    march
    1
    2
    3

    The word vacation would always equal 7.5 hours, but Vacation,2 would equal 2. So the total vacation hours would be 9.5 in this example

    Lori

  4. #4
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Countif down a column with multiple ifs

    @ lori can you upload a sample book

    Go to advanced tab and click manage attachment
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  5. #5
    Registered User
    Join Date
    01-18-2016
    Location
    Victoria, BC Canada
    MS-Off Ver
    2010
    Posts
    5

    Re: Countif down a column with multiple ifs

    Yes, here it is....

    Hope the attachment worked
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Countif down a column with multiple ifs

    two vacation cells would equal to 15 hours and and one vacation,2 cell would equal to 2 hour altogether should be equal to 17 hours
    Isn't it

    try below
    =(COUNTIF(B25:B402,"Vacation")*7.5)+(COUNTIF(B25:B402,"Vacation,2")*2)

  7. #7
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Countif down a column with multiple ifs

    or you can use
    =SUMPRODUCT(((B25:B402)={"vacation","vacation,2"})*{7.5,2})

  8. #8
    Registered User
    Join Date
    01-18-2016
    Location
    Victoria, BC Canada
    MS-Off Ver
    2010
    Posts
    5

    Re: Countif down a column with multiple ifs

    Yes you are correct....17 hours, my mistake. And thank you so much for the formulas. I will give them a try

    Lori

  9. #9
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Countif down a column with multiple ifs

    You are welcome Lori and thanks for the feedback

  10. #10
    Registered User
    Join Date
    01-18-2016
    Location
    Victoria, BC Canada
    MS-Off Ver
    2010
    Posts
    5

    Re: Countif down a column with multiple ifs

    Also....what if the 2 was another number.... Is there something that would cover any other number? It will not always be 2, it could be 3, or 4, etc.

    thanks

  11. #11
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Countif down a column with multiple ifs

    =SUMPRODUCT(((B25:B402)={"vacation","vacation,2"})*{7.5,2})

    whenever it encounters,VACATION will be multiplied by 7.5 and , Vacation,2 will be multiplied by 2 you can change them accordingly in {7.5,2} to lets say {1,3} or whatever your need is

    hope this helps.

    if this takes care of your question then you can mark thread solved and how to do that you can read my signatures in post#4

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Countif down a column with multiple ifs

    If you have many more different entries, apart from ,2, then perhaps consider using a helper column to extract that value from the string?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,366

    Re: Countif down a column with multiple ifs

    Following Ford's suggestion:

    in C25 and copy down

    =IFERROR(IF(LEFT(B25,8)="Vacation",SUBSTITUTE(B25,"Vacation,","")+0,""),"")

    in B20

    =COUNTIF(B25:B47,"Vacation")*7.5+SUM(C25:C47)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. COUNTIF Multiple cells in column
    By swaza in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-09-2015, 09:15 AM
  2. countif for multiple options in same column.
    By superchew in forum Excel General
    Replies: 1
    Last Post: 06-30-2015, 11:56 AM
  3. [SOLVED] Countif multiple criterai within 1 column
    By ctbanker in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-08-2014, 03:46 PM
  4. Trying to COUNTIF when multiple criteria are met on multiple column data set
    By TGCRequiem in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-15-2011, 12:58 AM
  5. Countif with multiple criteria:Column A Column B
    By Blardov in forum Excel General
    Replies: 1
    Last Post: 01-22-2009, 03:05 PM
  6. Countif using multiple variables within a column
    By schlicken in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-24-2007, 01:17 PM
  7. [SOLVED] Using Countif with multiple criteria in the same column.
    By Harley in forum Excel General
    Replies: 2
    Last Post: 12-12-2005, 10:30 PM

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