+ Reply to Thread
Results 1 to 10 of 10

Mutually Exclusive Entrees

  1. #1
    Registered User
    Join Date
    09-24-2012
    Location
    Bourne, MA, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Mutually Exclusive Entrees

    I have two cells that I want to restrict the user input to the letter "x." If the user inputs an x in one cell, I would like the other cell to be blank, and vice versa. Both cells cannot contain an x at the same time, but could both be blank at the same time (initial value is blank). The cells are consecutive cells in the same column. I would prefer not to use VBA to do this, since I am relatively unfamiliar with VBA programming, but would welcome any suggestion that I can figure out how to implement.

    Thanks for your help!

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Mutually Exclusive Entrees

    Use Data Validation > Allow - Custom > Formula

    and then someting like:

    =COUNTA(A1:A2)=1
    Gary's Student

  3. #3
    Registered User
    Join Date
    09-24-2012
    Location
    Bourne, MA, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Mutually Exclusive Entrees

    That restricts the second x from being entered. I was hoping that I could find a way that if a user entered the 2nd x, the first one disappeared. This is for a football pool, and the user can only choose one of the two teams, if that helps. So if they choose the home team, the visiting team selection cell is blank.

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Mutually Exclusive Entrees

    You can do exactly that with an event macro. Are you O.K. with macros??

  5. #5
    Registered User
    Join Date
    09-24-2012
    Location
    Bourne, MA, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Mutually Exclusive Entrees

    Never tried them, but am willing to try anything.

  6. #6
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Mutually Exclusive Entrees

    Install the following event macro in the worksheet code area:

    Please Login or Register  to view this content.

    Because it is worksheet code, it is very easy to install and automatic to use:

    1. right-click the tab name near the bottom of the Excel window
    2. select View Code - this brings up a VBE window
    3. paste the stuff in and close the VBE window

    If you have any concerns, first try it on a trial worksheet.

    If you save the workbook, the macro will be saved with it.


    To remove the macro:

    1. bring up the VBE windows as above
    2. clear the code out
    3. close the VBE window

    To learn more about macros in general, see:

    http://www.mvps.org/dmcritchie/excel/getstarted.htm

    To learn more about Event Macros (worksheet code), see:

    http://www.mvps.org/dmcritchie/excel/event.htm


    Note this is specific for cells A1 & A2, It can be adapted for any two cells

  7. #7
    Registered User
    Join Date
    09-24-2012
    Location
    Bourne, MA, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Mutually Exclusive Entrees

    So for each pair of teams, I would need to declare individual ranges, and have separate If statements, correct?

  8. #8
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Mutually Exclusive Entrees

    Yes, but I can help.

    Post the range pairs.

  9. #9
    Registered User
    Join Date
    09-24-2012
    Location
    Bourne, MA, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Mutually Exclusive Entrees

    They are H5:H6, H7:H8, H9:H10, H11:H12, H13:H14, H15:H16, H17:H18, H19:H20, H21:H22, H23:H24, H25:H26, H27:H28, H29:H30, H31:H32, H33:H34, and H35:H36 for Player 1. Player two uses the same cells in Column J, Player 4 in Column L, all the way to Player 11 in Column AB.

  10. #10
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Mutually Exclusive Entrees

    Very good.....I will attack the code tomorrow.

+ 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