+ Reply to Thread
Results 1 to 24 of 24

How do you protect cells on condition of other cells having data inputted?

  1. #1
    Registered User
    Join Date
    12-04-2006
    Posts
    24

    How do you protect cells on condition of other cells having data inputted?

    I need to find a way of protecting an array of cells on the condition that information is entered in another array of cells or vice versa. So, put simply, if data goes into a1 then a2 becomes protected (or vice versa). Can anyone help?

    Rick

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    As far as the principle is concerned, it is feasible with an event macro attached to the worksheet ...
    Shoud you need a precise answer, please upload a zipped copy of your worksheet ...

    HTH
    Carim

  3. #3
    Registered User
    Join Date
    12-04-2006
    Posts
    24
    Thanks Carim.

    I have uploaded a slimmed down version of my file as it consisted of many sheets. Essentially, I want to find out how to protect arrays of cells when i input data in certain cells, to prevent inaccurate data inputting. Hopefully my sheets are self explanatory. Give me a shout if you need to know any other information.

    PS this is my first go at a 'bigger sheet'

    Regards Rick

  4. #4
    Registered User
    Join Date
    12-04-2006
    Posts
    24
    I'm still having big problems with this. Can anyone help me out?

  5. #5
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    But where is the "slimmed down" version of your zipped file ...???

    Carim

  6. #6
    Registered User
    Join Date
    12-04-2006
    Posts
    24
    Oh. I will try again.
    Attached Files Attached Files
    Last edited by VBA Noob; 12-10-2006 at 02:55 PM.

  7. #7
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Rick,

    If you don't mind a couple of remarks ...

    1. Uploading a file without removing worksheet password is not going to help

    2. Not being specific about what you expect is not going to help ... either

    Please take the time to clearly express your request, in order to get the appropriate answer ...

    HTH
    Carim

  8. #8
    Registered User
    Join Date
    12-04-2006
    Posts
    24
    Hi Carim,

    Thank you for taking the time of downloading the sheet and bringing these points to my attention.

    To explain a bit of background, I am collecting data on people who use a counselling service. I am capturing whether they are an employee or a dependant and whether they had telephone counselling or face to face counselling. This is done on worksheet 'Cont. User Analysis (1)'. The contacts row at the top (c1-w1) is a reference number for each client and I input a '1' in the necessary cell. So for client 34, if you read vertically you will see that they are an employee and they used face to face counselling.

    The worksheet entitled 'statistics (1)' is for collecting more specific information pertaining to each client (demographics, how they used the service, etc..). I have set it up so as each table in the worksheet automatically takes the client number from the 'Cont. User Analysis (1)' that is needed for that particular table and enters it in the orange row at the top of each table. For example, client 36 does not appear in the demographics table as I do not want to collect data on dependants.

    Turning to my query, lets say that I want to mark client 34 as an employee. What I have done is enter a '1' in cell C3 on worksheet 'Cont. User Analysis'. Now, I would like the fact that I have done this to protect cell C4 as a client cannot be an employee and a dependant. As you can see, I also need it to work the other way around. If C4 is entered with a '1', then C3 becomes protected.

    On the worksheet 'statistics (1)', I want to implement this principle in many places. For instance, if the client is male he cannot be female, or if a client is married, he cannot be single/widowed/divorced. If the client is in the age range 16-24, he cannot be in any other age range.

    Currently a '1' can be entered haph-hazardly anywhere on both these sheets (which you will be able to see for yourself just by doing it!), which may introduce errors in the calculations (i.e someone who is both male and female etc..). I have used data validation so as only a '1' can be input into the arrays where I want to input data to prevent other numbers, words, letters, etc.. to be input. This goes someway to prevent errors in the calculation but I need to get it as watertight as possible.

    The 'Overview' sheet may be ignored as this just pulls data from all the other sheets to present an annual calculation of all the data. As I have 'cut down' the size of the workbook for uplaod, this is why #REF! appears.

    I hope this clarifies what I am trying to do. If not please feel free to ask further questions. I really do appreciate you spending time looking into my problem.

    If you need to unprotect the sheet, the password is 'password'

    Kind Regards

    Rick

  9. #9
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi Rick,

    I do understand your situation and the problem you want to solve ...
    My belief is that you are over-complicating your own life ...
    What you are asking for is feasible, say for two mutually exclusive cells ...

    Please Login or Register  to view this content.
    BUT ... for seven mutually exclusive cells, you will need a lot of patience...

    My recommendation would be to have as many validation lists as needed, stored in a Validation sheet, and all your fields with dropdown boxes would automatically become "mutually exclusive cells" ...

    Hope I have answered your question ...

    HTH
    Carim

  10. #10
    Registered User
    Join Date
    12-04-2006
    Posts
    24
    Thanks Carim. I'll look into doing that. I did not realise that using the principle that I had in mind was so long winded!!

    Thanks again

    Rick

  11. #11
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    You are welcome ...

    Glad you are going the "validation" way ...

    Do not hesitate to drop a post in the forum, should you need help ...

    Cheers
    Carim

  12. #12
    Registered User
    Join Date
    12-04-2006
    Posts
    24
    Hello, I'm back.

    Thanks for your excellent advice Carim. I have now re-formatted my spreadsheet using validation lists.

    My new problem is this:

    I have two rows that look like this:

    A B C D E F G
    1 Emp Emp Emp Dep Dep Emp Dep
    2 Tel f2f f 2f f2f Tel Tel Tel

    I need the formula that will count the number of 'Tel's if the cell above it is 'Emp'... Help would be truly appreciated.

    Rick

  13. #13
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi Rick,

    Why don't you upload a zipped copy of your worksheet ...
    It will be much faster ...
    HTH
    Carim


    Top Excel Links

  14. #14
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi Rick,

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    12-04-2006
    Posts
    24
    Wow Carim, you da man!! That does exactly what I want it to. I have looked in the Help menu at this function and I can't see why it should work. What is actually happening in this formula?

  16. #16
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    You are welcome

    Thanks for the feedback

    In my opinion, the best explanation about the sumproduct() function is provided by Bob

    http://www.xldynamic.com/source/xld.SUMPRODUCT.html

  17. #17
    Registered User
    Join Date
    12-04-2006
    Posts
    24
    Thanks for the link Carim. The SUMPRODUCT info allowed me to further refine my count.

    I would also like to add into this formula a further condition and I was wondering if you could tell me whether it is possible. I have attached a copy of the worksheet for simplicity.

    I would like to use the SUMPRODUCT function only on the condition that a date field falls between (or on) two dates specified in other cells.

    So, on my attached workbook, the sheet entitled 'Report 1' has cells C12 and C13 for dates. These are my specified dates that I want to count data between.

    On the 'Util Data 1' sheet C103:V103 are used for inputting dates. Note that I have set up the sheet so that with the dates in 'Report1' C12 and C13, 'Util Data 1' H103 should not be considered at all in the count because it lies outside of the date range.

    It may be worth noting that the SUMPRODUCT formulae are on 'Util Data 1' C98, C99, C100, C101 and it is each of these that I would like to update to take account of the date range.

    Is this possible?

    Thanks

    Rick
    Attached Files Attached Files

  18. #18
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Yes ... it is possible ... but where is located the formula to be amended ...
    I cannot find it ...

  19. #19
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi again ...

    Found it in cell W98 ...
    Attached is the amendment ...
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    12-04-2006
    Posts
    24
    Thank you once again Carim.

  21. #21
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    You are welcome ...

    You are going to become the top expert of the sumproduct() function ...

  22. #22
    Registered User
    Join Date
    12-04-2006
    Posts
    24
    Thanks for the link Carim.

    I have read Bob's explanation of the SUMPRODUCT function, and I understand it all apart from 'double unary' operator. I noted that when you amended my formula you substituted the double unary operator for my '*' operator.

    Could you, or anyone, tell me precisely what 'double unary' is?

    Thanks

    Rick...

  23. #23
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi Rick,

    Since sumproduct() is basically designed to work with numbers, the double unary operator takes care of text and transforms them into true or false, or rather into 1 and 0 ... in order to allow calculation ...

  24. #24
    Registered User
    Join Date
    04-28-2006
    Location
    California
    Posts
    15
    Quote Originally Posted by Carim
    You are welcome

    Thanks for the feedback

    In my opinion, the best explanation about the sumproduct() function is provided by Bob

    http://www.xldynamic.com/source/xld.SUMPRODUCT.html
    Now that was a great read.

    Thanks for sharing that. I think I need to use more SUMPRODUCT, it will make my life a little easier.

    Good read!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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