简体   繁体   中英

Turn multiple columns in excel into 1 column with unique value

I have a list of questions as series of columns in excel with around 10,000 rows. Yes or No is denoted by a 0 or 1 and only 1 question can be selected for any give row. What I'd like to do is take all these columns and merge them into 1 column where the value of each question is assign to a number instead. So for instance I have:

   Q1            Q2         Q3           Q4           Q5 
   0             1          0            0            0  
   0             0          0            1            0  
   0             0          1            0            0  
   0             1          0            0            0  
   1             0          0            0            0        

So instead I'd like to assign each question to a value like

Q1 = 1 Q2 = 2 Q3 = 3 Q4 = 4 Q5 = 5

and them merge it into one column like:

Questions
    2
    4
    3
    1 

Is there a decently simple way to accomplish this?

Use the Match function:

=MATCH(1,B2:F2,0)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM