Consulting

Results 1 to 8 of 8

Thread: Solved: Data Input Restrictions

  1. #1
    VBAX Regular
    Joined
    Oct 2010
    Location
    Texas
    Posts
    93
    Location

    Solved: Data Input Restrictions

    Hello Everyone,

    Is it possible to restrict data selected in one field based on items selected in another? I have two cells on a spreadsheet. Both have a drop down list of items set up through Data Validation. The drop down list for the first cell contains these items: A, B, C, AA, BB, and CC. The second cell has a drop down list with several items (too many to list here). The items in this second drop down list end in either SY or SW (ex:150SY or 250SW or ERT350SY). Item in list one A, B, C can only be paired with items from list two that end in SY. Items from list one AA, BB, and CC can only be paired from the items in list two that end in SW. Can these input restrictions be put in place using VBA code? If so, can you help me with this?

    Thank you for any assistance you can provide!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Have separate lists for the SY and SW types, and then a simple IF in the second to determine which to show.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Oct 2010
    Location
    Texas
    Posts
    93
    Location
    I'm not sure what you mean. Would you explain a little further please?
    Thank you!

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Create one list in M1:Mn say of values 150SY, ERT350SY, ...

    Add a name of SY with a formula of =OFFSET($M$1,,,COUNTA($M:$M),1)

    Create a second list in N1:Nn say of values 250SW, ...

    Add a name of SW with a formula of =OFFSET($N$1,,,COUNTA($N:$N),1)

    Assuming the first DV is in C1, in the second DV, with a type of List add a formula of =IF(OR($C$1="A",$C$1="B",$C$1="C"),SY,SW)
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Oct 2010
    Location
    Texas
    Posts
    93
    Location
    Thank you for your help!! I was able to solve this issue without using the Offset formulas. I used the If/Or statement in Conditional Formatting and just referenced the named ranges SW and SY. T
    Thank you again for your assistance!

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    In CF? Are you sure?

    The Offset was just so that you could additems to the lists without changing anything.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    VBAX Regular
    Joined
    Oct 2010
    Location
    Texas
    Posts
    93
    Location
    Yes, in CF. Fortunately both lists are constant and shouldn't change.
    Thank you again!!

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I thought we were talking DV not CF.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •