+ Reply to Thread
Results 1 to 6 of 6

Convert Range of numbers to Either 1,0

  1. #1
    Registered User
    Join Date
    11-21-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    3

    Convert Range of numbers to Either 1,0

    ID Q3.1_a Q3.1_b Q3.1_c Q3.1_d Q3.1_e Q3.1_f Q3.1_g
    1 2 21
    2 9 11 13 21
    3 1 11 28
    4 4 5
    5 4 7 11 28
    6 2 6 22

    I would like to convert the above excel data to 1 or 0's.

    There in 5nd row (ID=4) I will have 1 in the 4th and 5th cell, all others will have a Zero.

    V1 V2 V3 V4 V5 V6 V7 V8 V9
    0 0 0 1 1 0 0 0 0

    I could you an IF function, but then only way I know will have to look at each cell separately, if (Q3.1_a=1 OR Q3.1_b = 1. etc)
    Where I would rather lookup the range Q3.1_a:Q3.1_g

    Thanks for the help.
    Brendan

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Convert Range of numbers to Either 1,0

    Brendan

    What about the rest of the rows?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-21-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Convert Range of numbers to Either 1,0

    If you asking about the 6 rows in my example. Here goes.

    Row 2 - ID 1. 2nd and 21th cell will have a 1, the rest will all have zero's
    Row 3 - ID 2. The 9th, 11th, 13th and 21th cell will have a 1, the rest will all have zero's
    etc...

    I know that I can have a range between 1 and 71 in those cells so I would need 71 new cells in the new data.

    Does this explain better ?

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Convert Range of numbers to Either 1,0

    Brendan

    Are you just setting all the cells with a value not equal to 0 to 1?

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Convert Range of numbers to Either 1,0

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    11-21-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Convert Range of numbers to Either 1,0

    Dummy Data.xlsx

    I've attached the file, I hope it helps with my explanation.

    I don't want to just check where there are 1's or 0, but if I find a number put a 1 in it's location.

    Thanks,
    Brendan

+ 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