• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

To select Max of 3 Days

fareedexcel

Member
Hi Users,

Please help with a code. There are 5 (Days) columns from Sun-Thu, employees were asked to work max for 3 days in a week.

In case, if we try to input for the 4th day, an error message to pop up saying only 3 days can be selected. Employee can work any of the 3 days in a week. But not more than 3 days.
 

Attachments

  • Max to select 3 Coulmns.xlsx
    18.1 KB · Views: 4
Just use data validation. No need for VBA.

Select B2 and enter following as custom validation formula.
=SUM($B2:B2)<4

Then extend validation range to your data range and error message.

Note this assumes 1 is always used for selection. Change validation formula as required.
 

Attachments

  • Max to select 3 Coulmns.xlsx
    18.2 KB · Views: 2
Wild cross posting here !​
The same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.​
Please see forum rules about cross-posting and adjust accordingly.​
Read this to understand why we (and other sites like us) consider this to be important.​
 
Wild cross posting here !​
The same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.​
Please see forum rules about cross-posting and adjust accordingly.​
Read this to understand why we (and other sites like us) consider this to be important.​
I didn't understand. Please tell me what I need to do now.
 
Back
Top