How to change value from data validation based on value in col A?

Fractalis

Active Member
Joined
Oct 11, 2011
Messages
328
Office Version
  1. 365
Platform
  1. Windows
Hi, I have a in column A the day of the week (custom format with "ddd") based on the dates in column B. In column C I have a Data Validation list.

I need to manually select values from data validation list depending the day, but I'd like that in column C, fills automatically with "-" when day in column A is "Sat" or "Sun".
Now I need to select "-" when in column A there is a Saturday or Sunday. I'm attaching an image of what I have.

How can I do this? Thanks

| Day | Date | Value | | | List |
| --- | -------- | ----- | | | ---- |
| Sat | 6/1/2024 | \- | | | A |
| Sun | 6/2/2024 | \- | | | B |
| Mon | 6/3/2024 | B | | | C |
| Tue | 6/4/2024 | C | | | D |
| Wed | 6/5/2024 | B | | | \- |
| Thu | 6/6/2024 | C | | | |
| Fri | 6/7/2024 | D | | | |
| Sat | 6/8/2024 | \- | | | |
| Sun | 6/9/2024 | \- | | | |
 

Attachments

  • SampleDays.jpg
    SampleDays.jpg
    70.7 KB · Views: 10

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
A couple of options:

In this version, you have to install the formula first, then apply the data validation to the C2:C? range. If you choose the data validation, it will overwrite the formula, even on weekends.

Book1
ABCDEF
1DayDateValueList
2Sat6/1/2024-A
3Sun6/2/2024-B
4Mon6/3/2024 C
5Tue6/4/2024 D
6Wed6/5/2024 -
7Thu6/6/2024 
8Fri6/7/2024 
9Sat6/8/2024-
10Sun6/9/2024-
11
Sheet2
Cell Formulas
RangeFormula
C2:C10C2=IF(WEEKDAY(B2,2)>5,"-","")
Cells with Data Validation
CellAllowCriteria
C2:C10List=$F$2:$F$6


In this version, there is no formula, but the data validation changes based on the weekday. Weekends only have the dash as an option.


Book1
ABCDEFG
1DayDateValueListWE List
2Sat6/1/2024-A-
3Sun6/2/2024B
4Mon6/3/2024BC
5Tue6/4/2024CD
6Wed6/5/2024B-
7Thu6/6/2024C
8Fri6/7/2024D
9Sat6/8/2024
10Sun6/9/2024
Sheet1
Cells with Data Validation
CellAllowCriteria
C2:C10List=OFFSET($F$2,0,IF(WEEKDAY(B2,2)>5,1,0),IF(WEEKDAY(B2,2)>5,1,5))
 
Upvote 0
Solution
A couple of options:

In this version, you have to install the formula first, then apply the data validation to the C2:C? range. If you choose the data validation, it will overwrite the formula, even on weekends.

[/RANGE]

Hi Erick, thanks for answer.

I forgot to say that is in Excel 365. So, for what I want is not possible to use Data Validation only formula? I pasted it "=OFFSET($F$2,0,IF(WEEKDAY(B2,2)>5,1,0),IF(WEEKDAY(B2,2)>5,1,5))" in C2:C10 and it shows 0s for Saturday and Sunday and "SPILL!" for the other days.
 
Upvote 0
You don't paste that formula directly into the cell. If you use that version, first make sure that there's nothing in C2:C10. Next select C2:C10, go to the Data tab, click Data Validation, select List from the Allow: box, then enter that formula in the Source: box and click OK.
 
Upvote 1
You don't paste that formula directly into the cell. If you use that version, first make sure that there's nothing in C2:C10. Next select C2:C10, go to the Data tab, click Data Validation, select List from the Allow: box, then enter that formula in the Source: box and click OK.
Thanks so much. You guys are really masters in Excel. I was thinking this only was possible with VBA but now I see I was wrong. Regards
 
Upvote 0

Forum statistics

Threads
1,223,847
Messages
6,174,991
Members
452,598
Latest member
jeffreyp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top