What is the best way of creating a boolean column based on an integer column?

3 followers
0
Avatar

Hi Folks, what is the best way in a workbook of creating a boolean column based on an integer column. If I was to pseudo code it, it would be as follows:

OPEN CODE
if("#_CrashData2010!NUMBER_OF_PERSONS_INJURED">0)
{
"#
_CrashData2010!K" = true;
}
elseif("#_CrashData2010!NUMBER_OF_PERSONS_INJURED"==0)
{
"#
_CrashData2010!K" = false;
}
END CODE

Thanks in advance for your insights... I'm looking to have an extra boolan column based on an integer column returning the number of folks injured.

John Mulhall Answered

7 comments

  • Avatar
    Gido

    Hello John,

    Depending on your input data set and the values available you will have different possibilities.

    For a data set without negative or null values

    =IF(GT(#CrashData2010!NUMBEROFPERSONSINJURED;0); true; false)

    For a data set which might contain negative or null values it could be helpful to have an additional clearing rule.

    =IF(GT(#CrashData2010!NUMBEROFPERSONSINJURED;0); true; (IF(EQUALS(#CrashData2010!NUMBEROFPERSONSINJURED;0); false; null)))

    Will this work in the way you like?

    2
  • Avatar
    John Mulhall

    Hi, thanks for the formula dude.. it crashed the sheet with on both occassions with Sheet contains errors.
    Sheet 'CrashData2010' referenced in 'ProcDataSheet' does not exist in: [NYC_NYPD_CrashData2010, ProcDataSheet, ClusteringSheet1, artifactsheet_4c901ed4ade6440c9b0f19393b6faf8f, artifactsheet_3d1dfd8c1b594ac687308ad385d74453, artifactsheet_04095a6b0a374f19bd7c16ebcfa347a8, artifactsheet_f15a7ed2b1634cef97792bc7b55b5c8c].

    Any further insights on getting a boolean would be most appreciated... Thanks bro!!..

    0
  • Avatar
    Joel Stewart

    John - The error reported indicates that there is no sheet named "CrashData2010" in that workbook. It appears that there is a sheet named "NYCNYPDCrashData2010" though.

    Please ensure that a valid Sheet Name is used in the formula.

    0
  • Avatar
    John Mulhall

    Joel, thank you for this. It was a silly mistake! I have corrected my error and it works just fine. Will be back with more questions.. I am generating them as a I work an analysis..

    0
  • Avatar
    John Mulhall

    Hey Joel.. any other cool commands that are not immediately obvious like GT that a relative newbie like me would like. I presume LT is a command also?

    0
  • Avatar
    John Mulhall

    Thanks Gido & Joel... the Booleans work for me and have added value to the analysis... onwards we go bro's!

    0
Please sign in to leave a comment.