Converting drop-down boxes into digits

ignatiusvienna

New Member
Joined
Oct 7, 2016
Messages
6
Hey folks,
Having an issue with our Excel data collection and hoping for help.

I run data collection for national survey we are conducting for our organization. For years we have used an Excel spreadsheet to catalog the demographic information of our members and have used drop down boxes for ease of data entry. We now have access to SPSS and hope to use this for more in-depth data analysis. Unfortunately, SPSS requires digit values for categories and the drop-down information can’t simply be copy and pasted.

What I’m looking for is a formula that can convert the drop-down boxes in Excel into numbers, either replacing the drop-down information with digits, or placing corresponding digits in a new column (so they may then be copy and pasted into SPSS).

So, if for example we had a drop down for gender, in one column I have a drop-down list of
Male
Female
Male
Male
Male
(so on)

I want either that columns to convert to this, or have a sister column list:
1
2
1
1
1


Can this be done? Thank you in advance
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
A helper column is the easiest way:

Excel 2010
CD
1GenderGenderCode
2Male1
3Female2
4Male1
5Male1
6Male1
7Female2

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
D2=IF(C2="Male",1,IF(C2="Female",2,""))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Last edited:
Upvote 0
Excellent, thank you.

That seems to work well for two categories, but I get an error when there's more than 2 categories. How could I modify that formula to work for multiple options (ie: Male/Female/Transgender)
 
Upvote 0
So it's a nested IF statement. Within the formula, replace the double quotes with additional levels.

Example:
<!--StartFragment-->=IF(C2="Male",1,IF(C2="Female",2,IF(C2="Transgender",3,"")))<!--EndFragment-->
 
Upvote 0
So it's a nested IF statement. Within the formula, replace the double quotes with additional levels.

Example:
<!--StartFragment-->=IF(C2="Male",1,IF(C2="Female",2,IF(C2="Transgender",3,"")))<!--EndFragment-->
If the OP is willing to list the possible values in cell C2 in alphabetical order (remembering to coordinate the conversion numbers to that order when used for longer lists), this formula could be used...

=LOOKUP(C2,{"Female","Male","Transgender"},{2,1,3})
 
Last edited:
Upvote 0
Thank you for all your help! It's working great.
Last question, can this same kind of formula be used for converting a date into a digit. ie, we date our entries (9/15/2017 for example) and have categories of(early September, later September, Early October....).

Is there a way to have a helper column with this formula that takes the date and spits out a corresponding digit? (ie, 1 for early Sept, 2 Late Sept....)

Thank you a million
 
Upvote 0
Thank you for all your help! It's working great.
Last question, can this same kind of formula be used for converting a date into a digit. ie, we date our entries (9/15/2017 for example) and have categories of(early September, later September, Early October....).

Is there a way to have a helper column with this formula that takes the date and spits out a corresponding digit? (ie, 1 for early Sept, 2 Late Sept....)
For two choices, you could use this for your spelled out categories...

=IF(C2< C2-DAY(C2)+DAY(EOMONTH(C2,0))/2,"Early ","Late ")&TEXT(C2,"mmmm")

and this for you numbers...

=IF(C2< C2-DAY(C2)+DAY(EOMONTH(C2,0))/2,1,2)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,373
Messages
6,124,555
Members
449,170
Latest member
Gkiller

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