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??
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
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:
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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