+ Reply to Thread
Results 1 to 3 of 3

Need help to generate a dummy variable

  1. #1
    Registered User
    Join Date
    11-20-2010
    Location
    AL
    MS-Off Ver
    Excel 2007
    Posts
    1

    Need help to generate a dummy variable

    I have a column K with the title Cosponsr . It has numbers from 0 to 435.

    I would like to generate a column L that is a dummy, where if the number in K is 0 then code 1, where if it is greater than 0 code zero.

    Can someone help me generate this variable via a formula, as I cannot do VB or Macro's.

    Thanks !

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Need help to generate a dummy variable

    assuming if k1 = blank or a -ve number then blank
    =IF(OR(K1<0,K1=""),"",IF(K1>0,0,IF(K1=0,1,"")))
    if you're not worried about blanks or -ve's
    =IF(K1,0,1)
    Last edited by martindwilson; 11-20-2010 at 08:05 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Need help to generate a dummy variable

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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