Transforming data from 1 column into multiple
Hi all,
Sorry for the wonky title, I honestly couldn't think of what it should be... haha.
I am in the process of digitising an excel spreadsheet and have a long list of questions and categories in one row.
So the sheet contains a category, then the questions underneath it. then another category, then questions below it and so on. I need to have the category in each row, so when I transform the data into the system I am using, we know what category a question belongs to.
I need to be able to make it as automated as possible, as I am converting hundreds of these sheets haha.
This is the way that I get them:
Questions
Category 1
Question 1
Question 2
Question 3
Question 4
Category 2
Question 5
Question 6
Question 7
And I need to transform them like this:
|Questions|Category| |:-|:-|:-| |Category 1| |Question 1|Category 1| |Question 2|Category 1| |Question 3|Category 1| |Question 4|Category 1| |Category 2| |Question 5|Category 2| |Question 6|Category 2| |Question 7|Category 2|
I need a formula that will know that a category is a category for the right question (whether I add an extra column when I am transforming them or something), I just cannot think of how to do it.
Edit - formatting
Posted Apr 20, 2021, 2:19 AM UTC
If they’re labeled Category and Question then you can this formula in B2 =IF(ISNUMBER(SEARCH(“Category”,A2)),A2,B1) ... this searches the text to the left for the word Category, if it appears it returns the position of the word in the string - assuming that exists (is a number) then B2 = A2 otherwise B2 = B1 (if it’s a question then set it equal to the category above it.
If it isn’t marked category but all the questions have question marks in them you can use the same function but replace “category” with “?” And then switch the last B1 and A2 with each other