+ Reply to Thread
Results 1 to 10 of 10

Creating Dummy Variables using Excel

  1. #1
    Registered User
    Join Date
    08-11-2015
    Location
    Amsterdam
    MS-Off Ver
    2011
    Posts
    13

    Creating Dummy Variables using Excel

    Hi all,

    I'm having an excel sheet with 10 existing columns (each column represent one owner).

    The values 1 and 2 in the cells stand for Male or Female.
    IMG_1137 (1).JPG

    Now I have to create dummy variables,
    where Dummy1=1 when the group consist of 2 people; 1 male and 1 female
    where Dummy2=1 when the group consist of 2 people with equal gender
    where Dummy3=1 when the group consist of 3 or more people (disregard gender)

    Could anyone please help me with a formula for this?
    My aim is to create a new column for each dummy, where value is 0 or 1.

    Thanks in advance!

    Bob
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,905

    Re: Creating Dummy Variables using Excel

    Please post a small sample file showing data and expected outcomes.

    Click "Go advanced" the "Paper clip" icon to Upload a file.

  3. #3
    Registered User
    Join Date
    08-11-2015
    Location
    Amsterdam
    MS-Off Ver
    2011
    Posts
    13

    Re: Creating Dummy Variables using Excel

    Here you go;

    Creating Dummies.xlsx

    Thanks in advance!!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,494

    Re: Creating Dummy Variables using Excel

    Maybe these:

    Dummy1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Dummy2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Dummy3:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Dummy4:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,494

    Re: Creating Dummy Variables using Excel

    Having seen your example, you need to adjust the ranges from A:J to B:K

    Regards, TMS

  6. #6
    Registered User
    Join Date
    08-11-2015
    Location
    Amsterdam
    MS-Off Ver
    2011
    Posts
    13

    Re: Creating Dummy Variables using Excel

    Thanks TMS, however when I put them into my Excel file, it says the formulas contain an error... also with I change A:J into B:K

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,494

    Re: Creating Dummy Variables using Excel

    Updated sample workbook with slight adjustment to the combined Dummy4 to cater for only 1 person in a group.
    Attached Files Attached Files

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,494

    Re: Creating Dummy Variables using Excel

    That'll be down to Regional Settings ... commas vs semi-colons. See the workbook.

  9. #9
    Registered User
    Join Date
    08-11-2015
    Location
    Amsterdam
    MS-Off Ver
    2011
    Posts
    13

    Re: Creating Dummy Variables using Excel

    Thanks TMS, great!!

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,494

    Re: Creating Dummy Variables using Excel

    You're welcome. If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 02-17-2013, 04:06 AM
  2. [SOLVED] Replace cells and create dummy variables
    By slacknoise in forum Excel General
    Replies: 7
    Last Post: 06-18-2012, 02:40 PM
  3. dummy variables
    By Miloud in forum Excel General
    Replies: 2
    Last Post: 11-25-2009, 02:50 PM
  4. Generate lagged dummy variables
    By tianyi86 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-30-2009, 01:28 PM
  5. Dummy variables
    By Miloud in forum Excel General
    Replies: 2
    Last Post: 02-06-2009, 03:55 AM
  6. LINEST for dummy variables?
    By BlueFortyTwo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-25-2007, 10:00 PM
  7. Insert dummy variables
    By Chris_t_2k5 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-26-2006, 09:30 AM

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