+ Reply to Thread
Results 1 to 9 of 9

Counting if a word appears an odd number of times

  1. #1
    Registered User
    Join Date
    05-05-2021
    Location
    United Kingdom
    MS-Off Ver
    Office 365
    Posts
    45

    Counting if a word appears an odd number of times

    Hi All,

    I have a roster system created (thanks to the expertise of Bernie from this forum), for each week if a shift is swapped we put the letters SWP in a cell (with the initials of the person they are swapping with), but obviously if there is one SWP in a cell there should be another SWP in another cell in the same column (with the person they are swapping with). So there should always be either 0 or an even number of SWPs written in each column.

    Is there any way to conditionally format if there is an ODD number of 'SWPs' in a column, the ideal scenario would be that if there is one SWP, the one cell is highlighted because another SWP must be put in.

    I hope I have been clear enough.

    In summary I want to count if a word appears an odd number of times.

    Thank you,
    H
    Last edited by hboss_1; 05-19-2021 at 09:45 AM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: Counting if a word appears an odd number of times

    You can use COUNTIF to count the number of "SWP"'s in the column, and you can use MOD(... , 2)=1 around that to determine if the number is odd. You haven't said which column the SWP will be recorded in, and I don't want to guess. You can attach a sample Excel workbook by following the instructions in the yellow banner at the top of the screen.

    Hope this helps.

    Pete

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,496

    Re: Counting if a word appears an odd number of times

    Assum D1:D16 contain number of "SWP"

    Choose D1:D16, then using below formula in Conditional formatting:

    Please Login or Register  to view this content.
    Attached Images Attached Images
    Quang PT

  4. #4
    Registered User
    Join Date
    05-05-2021
    Location
    United Kingdom
    MS-Off Ver
    Office 365
    Posts
    45

    Re: Counting if a word appears an odd number of times

    Hi Pete,

    If the data is from B6:B37, how would the formula look?

    Thank you,

    H

  5. #5
    Registered User
    Join Date
    05-05-2021
    Location
    United Kingdom
    MS-Off Ver
    Office 365
    Posts
    45

    Re: Counting if a word appears an odd number of times

    Hi Both,

    See below here is an example column. As you can see there are two cells with SWPs and initials indicating they are swapping with each other. The SWP in a cell further down is on it's on, when there should be another SWP indicating the swap.

    Bebo I tried the formula, it seems to always highlight the final cell occupied with MX, as well as only highlighting when it ONLY contains the word MX. I want to count if it contains MX.

    Sorry if I was unclear,

    Thank you,

    H
    Attachment 733140
    Last edited by hboss_1; 05-19-2021 at 11:41 AM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,624

    Re: Counting if a word appears an odd number of times

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: Counting if a word appears an odd number of times

    In your example file you show all cells containing SWP (five in the upper table, from row 6 to 37) in red, although you have asked to highlight only those containing SWP (with no extra data), so I'm a bit confused. Isn't it just a matter of highlighting cells containing only SWP for each day, whether it is an even number or odd (as you will need to add that extra data about who to swap with and when)?

    Pete

  8. #8
    Registered User
    Join Date
    05-05-2021
    Location
    United Kingdom
    MS-Off Ver
    Office 365
    Posts
    45

    Re: Counting if a word appears an odd number of times

    You are entirely correct, I was overthinking things again !!!
    Thank you for your help,

    H

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: Counting if a word appears an odd number of times

    Glad to help - thanks for the rep.

    Pete

+ 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. [SOLVED] Counting amount of times capital word appears in list of rows
    By mrsak87 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-29-2018, 04:15 AM
  2. Counting the number of times a word appears with a twist
    By laurigardner in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-02-2017, 12:37 AM
  3. Help with counting the number of times a certain text appears
    By buckles23 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-04-2014, 11:53 AM
  4. Counting number of times a word appears across worksheets
    By danltd in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-24-2012, 04:33 AM
  5. Replies: 19
    Last Post: 05-26-2011, 04:15 PM
  6. Counting the number of times a word appears 'anywhere' on a page
    By Brother Laz in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-17-2006, 10:10 AM
  7. [SOLVED] [SOLVED] Counting the number of times a word appears in a worksheet
    By Jig Bhakta in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-02-2005, 11: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