1

So I have this excel file that contains features from 211 cars and their values (e.g. fuel type, engine type, etc.). I have to do an analysis on that data using Orange, but I have one problem. A few of the features, for example fuel type, has values that are strings (diesel or gas). I want to convert that to a number, so that diesel becomes 0 and gas becomes 1 or whatever. Is there anyway to do this in excel 2010 without having to convert them manually? Thanks in advance.

Tim

1
  • You can use excel formula Commented Dec 1, 2014 at 12:13

2 Answers 2

1

You can use below formula (IF Function in excel)

=IF(A1="DIESEL",0,IF(A1="GAS",1,A1)) 

Syntax:

IF (CONDITION, VALUE_IF_TRUE, VALUE_IF_FALSE) 

You will get output data as follows:

A B ---------------------- DIESEL 0 GAS 1 OTHERS OTHERS 
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, that really seemed to help. One more question. What is the difference between using that and just using control f and replacing gas with 1 and diesel with 0? (That was an answer of a friend of mine).
Sure, You can do that also. But if you add additional records, you may have to find and replace again. Whereas, if formula, you just have to apply formula and the values will be replaced for new records also..
1

Create a Table with two columns:

oil 0 gas 1 ... 

then use

=vlookup(cell_w_string,Table_above,2,0) 

where cell_w_string is a reference to you values that are strings and Table_above is Table created above. Should work.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.