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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

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:
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,987
Messages
5,834,720
Members
430,313
Latest member
smartykatwinks

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