+ Reply to Thread
Results 1 to 9 of 9

How to change a cell colour depending on if another cell has the word Sun and or Sat

  1. #1
    Registered User
    Join Date
    03-12-2013
    Location
    London
    MS-Off Ver
    O365
    Posts
    39

    Thumbs up How to change a cell colour depending on if another cell has the word Sun and or Sat

    Hi All, I was wondering if you can help. I am trying to create a Team rota for a year in excel 2016. What I have done so far:
    In cell B2 I am using the CalendarYear formula to show 2023. In Cell B9 I have a list of team members to cell B30. I have entered each day of the year starting in cell H8 to cell NI8. The months are in cell H7. I used the formula =TEXT(WEEKDAY(DATE(CalendarYear,1,H$8),1),"ddd") in cell H8 to display the days (Mon-Sun). What I am trying to do is have a formula or conditional formatting to change ever cell colour that has Sat and Sun in the range H8:NI30. As an example in January 2023, Sun 1st, I want the cells from H9 to H30 to be in a different colour and the same for 7th and 8th (Sat & Sun), etc.. I tried to goggle this but all i was getting was all the cells was in a different colour. Really hope that makes sense, any help will be truly appreciated.

    Thank you, ArchieBook2.xlsx
    Last edited by Archie11; 03-27-2023 at 05:22 PM. Reason: insert attachment

  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,461

    Re: How to change a cell colour depending on if another cell has the word Sun and or Sat

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.
    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 Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,732

    Re: How to change a cell colour depending on if another cell has the word Sun and or Sat

    Select the range H8:NI30 so that you only need to do this once, then click on Conditional Formatting | New Rule | Use a formula... , then enter this formula in the dialogue box which pops up:

    =LEFT($B8)="S"

    then click on the Format button | Fill tab and choose the colour that you want for the weekends, then OK your way out. Excel will automatically adjust the cell reference to suit the selected range, so you should see your chosen colour applied to the weekend columns.

    In future, it would help if you attached a sample Excel workbook, as Trevor has suggested.

    Hope this helps.

    Pete

    EDIT: I've re-read your post, and it seems that the days of the week are in H8:NI8, with the data below. In that case, select the range H9:NI30 and use this formula:

    =LEFT(H$8)="S"

    Hope this helps.

    Pete
    Last edited by Pete_UK; 03-26-2023 at 05:26 PM.

  4. #4
    Registered User
    Join Date
    03-12-2013
    Location
    London
    MS-Off Ver
    O365
    Posts
    39

    Re: How to change a cell colour depending on if another cell has the word Sun and or Sat

    Thank you for coming back to me. I have attached the file.

  5. #5
    Registered User
    Join Date
    03-12-2013
    Location
    London
    MS-Off Ver
    O365
    Posts
    39

    Re: How to change a cell colour depending on if another cell has the word Sun and or Sat

    Hi Pete_UK, I tried =LEFT(H$8)="S" but it didn't change any of the cells. I have attached the file, maybe that will be easier to see what i am trying to do.

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

    Re: How to change a cell colour depending on if another cell has the word Sun and or Sat

    It is because the days of the week are on row 7, and NOT row 8, as you described.

    Pete

  7. #7
    Registered User
    Join Date
    03-12-2013
    Location
    London
    MS-Off Ver
    O365
    Posts
    39

    Re: How to change a cell colour depending on if another cell has the word Sun and or Sat

    Pete_UK, apologies. Thank you mate you are a legend

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

    Re: How to change a cell colour depending on if another cell has the word Sun and or Sat

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark the thread as SOLVED.

    You might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

    By the way, thanks Trevor.

  9. #9
    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,461

    Re: How to change a cell colour depending on if another cell has the word Sun and or Sat

    By the way, thanks Trevor.
    You're welcome

+ 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. Replies: 1
    Last Post: 01-07-2022, 08:02 PM
  2. Replies: 2
    Last Post: 08-11-2018, 05:22 AM
  3. Formula to change colour AND text in cell depending on value in adjacent cell
    By helsbels44 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-01-2017, 11:03 AM
  4. Help change cell colour depending on date in another cell
    By nubehaviour in forum Excel General
    Replies: 8
    Last Post: 01-14-2013, 07:04 PM
  5. Change cell text depending on colour of a cell
    By wonderdunder in forum Excel General
    Replies: 3
    Last Post: 09-22-2010, 11:31 AM
  6. Change Cell Colour Depending on Date
    By Owlsfan in forum Excel General
    Replies: 2
    Last Post: 07-27-2008, 06:15 AM
  7. Replies: 2
    Last Post: 01-06-2006, 03:50 AM

Tags for this Thread

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