Help with dummy variable

Lorna087

New Member
Joined
Feb 23, 2011
Messages
5
Ok I need help so any contribution would be greatly appreciated. In column A I have different occupations labelled 1,2,3,4 and 5. But I want to create a dummy variable that combines both 2,3 and 4, where the figure 1 would appear if you are a worker within occupations 2,3 and 4, and 0 if not (so 1 if values are true and 0 if not). I've tried using
=IF(COUNT(SEARCH("2,3,4",A2)),1,0) but this doesnt seem to work as I either get all values equal to 1 or 0 not real values.... Any ideas what I'm doing wrong here??
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

CWatts

Well-known Member
Joined
Jan 22, 2010
Messages
701
You can use this in another column if that would work for you.

=if(or(a1=2,a1=3,a1=4),1,0)
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,123,269
Messages
5,600,633
Members
414,396
Latest member
rinianjell

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
Top