+ Reply to Thread
Results 1 to 7 of 7

Count numbers that are part of text cells with conditions

  1. #1
    Registered User
    Join Date
    11-12-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    14

    Thumbs up Count numbers that are part of text cells with conditions

    Hi,

    I hope someone will be able to help me just as they have before.

    I want to build in an automatic check to my staff off duty sheet (attached) to make sure that I have 2 or more people arriving at 0800 and 2 or more people staying until 1820.

    In B151 I want to count the number of times 0800 appears in the shift times line of each persons rota, but I need to take away from that the number of times "ODU" appears in the top line of each persons shifts.

    In B152 I want to count the number of times 1820 appears in the shift times line of each persons rota, but I need to take away from that the number of times ODU appears in the bottom line of each persons shifts.

    Then I would copy this across to C151, D, E, F.

    I tried starting simple and counting the number of 0800s using the following:
    =COUNTIF((B135,B130,B125,B120,B115,B110,B105,B100,B95,B90,B85,B80,B75,B70,B65,B60,B55,B50,B45,B40,B35,B30,B25,B20,B15,B10),"*0800*")
    But that returns a #VALUE! result.

    I'm not great with excel and would appreciate any help.
    Attached Files Attached Files
    Last edited by danieloverton1984; 06-15-2016 at 08:16 AM. Reason: Solved

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,915

    Re: Count numbers that are part of text cells with conditions

    Try this ...

    =SUMPRODUCT((LEFT(B10:B135,4)="0800")*(MOD(ROW(B10:B135),5)=0))
    Last edited by Phuocam; 06-15-2016 at 07:12 AM.

  3. #3
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Count numbers that are part of text cells with conditions

    =SUMPRODUCT(ISNUMBER(SEARCH("*0800*",B6:B150))*(MOD(ROW(B6:B150)-MIN(ROW(B6:B150))+1,5)=0))
    Try this
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  4. #4
    Registered User
    Join Date
    11-12-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: Count numbers that are part of text cells with conditions

    Thanks thats great and counts the total number of 0800 starters. How could I modify that formula to count the number of times ODU appears in ONLY these cells B131,B126,B121,B116,B111,B106,B101,B96,B91,B86,B81,B76,B71,B66,B61,B56,B51,B46,B41,B36,B31,B26,B21,B16,B11,B6.

    Thanks.

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,915

    Re: Count numbers that are part of text cells with conditions

    Change (MOD(ROW(B10:B135),5)=0)

    to (MOD(ROW(B10:B135),5)=1) etc...

  6. #6
    Registered User
    Join Date
    11-12-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    14

    Talking Re: Count numbers that are part of text cells with conditions

    Quote Originally Posted by Phuocam View Post
    Try this ...

    =SUMPRODUCT((LEFT(B10:B135,4)="0800")*(MOD(ROW(B10:B135),5)=0))
    Quote Originally Posted by Phuocam View Post
    Change (MOD(ROW(B10:B135),5)=0)

    to (MOD(ROW(B10:B135),5)=1) etc...
    GREAT! Thanks for the help! I dont understand any of it, but it works perfectly. Even managed to modify it to count the 2 groups of staff seperately. Attached is the finished sheet if anyone is interested.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,915

    Re: Count numbers that are part of text cells with conditions

    You're welcome, good luck!

+ 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. Count Range Of Cells That Contain Text That Includes Numbers And Letters
    By RaffPost in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-25-2015, 11:13 AM
  2. Replies: 3
    Last Post: 08-16-2015, 07:03 PM
  3. [SOLVED] Using a column of numbers stored as text to count on conditions
    By CWatsonJr in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-07-2013, 02:54 PM
  4. count cells that contain part of text
    By Aka89 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-23-2013, 06:27 PM
  5. [SOLVED] Count cells that contain both numbers & text in same cell
    By cnjstewart in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-24-2012, 02:22 PM
  6. Part 2: Count and identify text
    By SueWithQuestion in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-25-2011, 09:37 AM
  7. Count the text in a column - Part II
    By Peter Curtis in forum Excel General
    Replies: 3
    Last Post: 01-06-2005, 03:06 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