Data validation with sum of values limit

estephenkim

New Member
Joined
Feb 6, 2016
Messages
27
Office Version
  1. 365
Platform
  1. Windows
I'm creating a user input sheet of weights from a data validation list for each of four items (see image below). I'd like to code it so that it prevents the user from being able to enter (or at least issues a warning against entering) a cell value that results in the sum total of all four cells exceeding 100%. Is this possible to do? If so, how would you do it?


Sample%20weight%20input%20sheet_zpsldxrvuac.png
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You can set the validation condition for each of the 4 cells separately. For example, for A3 the custom validation condition is:

=A3<=100-SUM(A1,A2,A4)

Use analogous conditions for each of the other 3 cells. Remember that the user can defeat validation using a paste to any or all of the 4 cells. If you want to protect against pasting, you will need VBA.
 
Upvote 0
Thanks for your response, JoeMo. The custom validation formula addressed the total weight limit and provided a nice, instantaneous error-correction situation, but I wanted to keep the drop-down list functionality and I still had the issue with the copy & paste loophole. Also, I hadn't considered the situations in which the total weight summed to less than 100%. Thus, I decided to add a user instruction message and a Total weight (%) cell, to which I added a couple conditional formats to change the cell color green or red, to help the user ensure that the total weight equals 100%.


Sample%20weight%20input%20sheet%202_zpsqz1picbp.png
 
Upvote 0

Forum statistics

Threads
1,215,487
Messages
6,125,075
Members
449,205
Latest member
Healthydogs

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