I am trying to use this formula in cinditional formatting to highlight cells in the…
- User
I am trying to use this formula in cinditional formatting to highlight cells in the range B1:BK1 tha contains dates that are weekend dates. The formula is being rejected: =WEEKDAY(B1,2)=1 OR WEEKDAY(B1,2)=7
- Assistant
The formula you provided is correct for checking if the weekday is either Saturday (7) or Sunday (1):
=WEEKDAY(B1,2)=1 OR WEEKDAY(B1,2)=7
If the formula is being rejected, make sure of the following:
- Use the correct range reference: If you want to apply this conditional formatting to the cells in the range B1:BK1, enter this formula in the conditional formatting rule for cell B1.
- Choose the correct cell reference for the weekday check: The formula you provided works for a single cell (e.g., B1). In the conditional formatting rule for cell B1, the conditional formatting rule should be applied to all cells in the range B1:BK1, so the formula should refer to the active cell in the range.
- Check the format of the dates in cells B1:BK1: Ensure that the dates are formatted correctly in the cells (e.g., as dates and not text).
If you've checked the above points and the formula is still being rejected, there might be other issues with your conditional formatting rules. Let me know if you need further assistance or if you have more specific details about the error message you're encountering.
- User
Can you provide a different formula I can use with conditional formatting that will do the same, highlight dates found that are weekends
- Assistant
Sure! You can use the following formula in conditional formatting to highlight weekend dates in the range B1:BK1:
- Select the range B1:BK1.
- Go to the Home tab on the Excel ribbon.
- Click on "Conditional Formatting" in the Styles group.
- Choose "New Rule" from the drop-down menu.
- Select "Use a formula to determine which cells to format."
- Enter the following formula in the formula box:
=OR(WEEKDAY(B1,2)=7)
- User
the days it highlighted were Sunday & Monday
- Assistant
I apologize for the oversight in the previous formula. To highlight only Saturday and Sunday dates in the range B1:BK1, you can use the following formula in conditional formatting:
- Select the range B1:BK1.
- Go to the Home tab on the Excel ribbon.
- Click on "Conditional Formatting" in the Styles group.
- Choose "New Rule" from the drop-down menu.
- Select "Use a formula to determine which cells to format."
- Enter the following formula in the formula box:
=OR(WEEKDAY(B1,1)=7)
- User
How can this be done in excel: Range B1:BK1 contains dates that correspond to days of the month. Range B3:BK3 contains empty values and some of the cells contain the letter 'a' For each cell in the range B3:BK3 if the cell value is 'a' it corresponds to the date value in the same column of the range B1:BK1. Starting from B3 I would like to search the row to BK3 for the first 'a' found I want to get the date value in the smame column of the range B1:BK1 and write the date to BN3 For the last 'a' found I want to get the date value in the smame column of the range B1:BK1 and write the date to BO3
- Assistant
To achieve this in Excel, you can use a combination of formulas and functions to search for the first and last occurrence of the letter 'a' in the range B3:BK3, and then retrieve the corresponding date value from the range B1:BK1.
Here's a step-by-step guide on how you can implement this:
- In cell BN3, input the following formula to retrieve the date value corresponding to the first occurrence of 'a' in the range B3:BK3:
=INDEX(B$1:B$1, MATCH("a", B3:BK3, 0) + COLUMN(B3:BK3) - COLUMN(B3))This formula uses the INDEX and MATCH functions to find the first occurrence of 'a' in the range B3:BK3 and return the corresponding date value from the range B1:BK1.
- In cell BO3, input the following formula to retrieve the date value corresponding to the last occurrence of 'a' in the range B3:BK3:
=INDEX(B$1:B$1, MATCH(2, COUNTIF(B3:BK3, "a") + COLUMN(B3:BK3) - COLUMN(B3), 0))
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.