Dummy variables

Izila

New Member
Joined
Aug 27, 2019
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hi, I wish to create a dummy variable from one of the variables I am analyzing. I have four types of houses in a survey (1 - 4). Data input in that cell is from 1 to 4, integers. now, i want the excel spreadsheet to assign a 1 in a new dummy variable column that correspond to that number or 0 if it does not. I have illustrated this in a table below. I have over 1000 rows to analyse. please help


houseHouse
Type 1
House
Type2
House
Type3
House

Type4
40001
30010
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Book1
BCDEF
3houseHouse Type1House Type2House Type3House Type4
440001
530010
Sheet5
Cell Formulas
RangeFormula
C4:F5C4=IF(--RIGHT(C$3)=$B4,1,0)
 
Upvote 0
You are welcome
Thanks for the feedback

or simpler: =--(--RIGHT(C$3)=$B4)
 
Last edited:
Upvote 0
or simpler: =--(--RIGHT(C$3)=$B4)
I was just drafting something along similar lines - see below.

Since you are using 1 and 0 as the results, you don't really need the IF function.

Also, if you were to number the columns, say above, like I have in the bottom section, the formula becomes even simpler and it wouldn't matter if the house descriptions did not have the number on the end.

20 08 15.xlsm
BCDEF
2
3House Type1House Type2House Type3House Type4
440001
530010
6
7
81234
9SmallMediumLargeMansion
1040001
1130010
0 v 1
Cell Formulas
RangeFormula
C4:F5C4=--(RIGHT(C$3)-$B4=0)
C10:F11C10=--($B10=C$8)
 
Upvote 0
I was just drafting something along similar lines - see below.

Since you are using 1 and 0 as the results, you don't really need the IF function.

Also, if you were to number the columns, say above, like I have in the bottom section, the formula becomes even simpler and it wouldn't matter if the house descriptions did not have the number on the end.

20 08 15.xlsm
BCDEF
2
3House Type1House Type2House Type3House Type4
440001
530010
6
7
81234
9SmallMediumLargeMansion
1040001
1130010
0 v 1
Cell Formulas
RangeFormula
C4:F5C4=--(RIGHT(C$3)-$B4=0)
C10:F11C10=--($B10=C$8)
thank you very much for your help peter
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top