Convert Excel columns into rows (text data, not numbers) - excel

I have a spreadsheet in Excel that contains a "Member ID" in the first column, with six variables, related to this Member ID, in the next six columns.
I need to somehow convert these columns into rows, but still have the Member ID column at the beginning of each row.
Here's the data as it stands (there are 5000 rows, hence hoping to find an automated solution):
MEMBER 1 | AAA | BBB | CCC | DDD | EEE | FFF
MEMBER 2 | BBB | ZZZ | FFF | AAA | RRR | SSS
MEMBER 3 | YYY | FFF | OOO | MMM | PPP | AAA
And here's the format that I need:
MEMBER 1 AAA
MEMBER 1 BBB
MEMBER 1 CCC
MEMBER 1 DDD
MEMBER 1 EEE
MEMBER 1 FFF
MEMBER 2 BBB
MEMBER 2 ZZZ
MEMBER 2 FFF
MEMBER 2 AAA
MEMBER 2 RRR
MEMBER 2 SSS
MEMBER 3 YYY
MEMBER 3 FFF
MEMBER 3 OOO
MEMBER 3 MMM
MEMBER 3 PPP
MEMBER 3 AAA
I attempted to follow the steps in this question: Split multiple excel columns into rows , however that seems to only work for numeric values and not text.
Any help that anyone can give me would be hugely appreciated, I'm stumped as to how to do this. Thanks so much in advance!

This question is stale but I just needed it, so I'll answer.
I found the solution by Chris Chua on Quora, please upvote him there if this is helpful: https://www.quora.com/How-do-I-convert-multiple-column-data-into-a-column-with-multiple-rows-in-excel
I'll also copy-paste it here in case of a broken link:
Apologies. I can’t really see the writings clearly, but I’m assuming that you want to unpivot the column headers as part of the data set.
Here I am suggesting a solution using Microsoft Excel’s Power Query feature. If you have Excel 2016, the feature is found under Data | Get & Transform ribbon command. Otherwise if you have Excel 2013 or the Professional Plus version of 2010, you can download the Power Query add-in from here.
Step 1: Select all the data, press Ctrl+T to create a table, and under Create Table, make sure that My table has headers is selected.
Sample data create table dialog
Step 2: In Excel 2016, go to Data | Get & Transform | From Table. For Power Query add-in for Excel 2013 and 2010, look for something in the Power Query tab ribbon that says From Table.
Ribbon location for "From Table"
Step 3: The Power Query interface will open up. Click on the header of No. Column, hold Ctrl and click on the header of the Name Column. With both columns now selected, right click on the headers and select Unpivot Other Columns.
Right Click, Unpivot Other Columns screencap
Step 4: Notice that the data is now unpivoted (which is what you wanted). Double click on the Attribute and Value headers to rename them.
Step 5: Click Home | Close & Load.
Close & Load screencap
Step 6: Excel will load the new cleaned up table onto a new sheet. Ta-da you’re done!
Screencap of pivoted table, which is the desired output.
To update any new data in the future:
Supposed you now have new data in your original table.
Updated sample data table screencap with a new column, row and value inserted.
Go to the new cleaned up table, right click and select Refresh.
Screencap of right-clicking inside the pivoted output table, clicking Refresh.
The new data will be updated immediately.

This should be doable, try saving excel file as csv then make a script to format that csv to your liking then import csv into excel.
There are many scripting languages like bash, powershell, python and tutorials on how to different things with them. Python is beginner friendly.

Thanks Spidey for your help. I managed to get it sorted using Sublime Text rather than Excel.
For those interested, I just copied the six columns into Sublime Text, did a find & replace for the gap/space/tab character between each column and turned this gap into a return/new line. That gave me a giant list of variables.
I then copied in the first column (Member ID), selected all the rows and did "Split selection into lines", which gave me a cursor at the end of each line. I then just selected each line and did a copy -> return -> paste, six times. This gave me a giant list of each Member ID showing up six times.
Then it was just a matter of (in Excel) pasting that long Member ID list into Column A, with the long list of variables (from the first step) into Column B. Done!

Related

PowerBI multiple values in same column displayed as table format with no data

I'm trying to create a PowerBi dashboard from SharePoint list. The problem is one of the column contains "People or Group" where it intakes multiple names. This column is read as a table in PowerBi and when expanded, returns empty though there is data. Similarly, I have another column with "People or Group" but it only takes one name which works fine when expanded returning values.
Sample Data
ColA ColB ColC
1 John Doe John Doe, Tim Apple
2 Tim Apple Tim Apple, Steve Cook
3 Steve Cook Tim Apple
From above, ColB works fine for data extraction but ColC return empty without any data.
I've attached a PowerBI screenshot for reference .
I was able to figure this. I used the column FieldValuesAsText to convert all the lists and tables as regular text without any issues. This column converts multiple columns at the same time, thereby saving a lot of time too...

How to merge data of two excel sheets into the third sheet with some cleansing operations

I have a homework assignment where I have to merge data of two excel sheets by performing some cleansing operations using formulas.
Sheet 1:
OrderID | Full Name | Customer Status
1001 Waqar Hussain Silver
2002 Ali Moin Gold
Sheet 2:
OrderID | First Name | Last Name | Customer Status
A1003 Junaid Ali 2
A2004 Kamran Hussain 1
Sheet 3:(Combined Sheet) - Expected
OrderID | Full Name | Customer Status
1001 Waqar Hussain Silver
2002 Ali Moin Gold
1003 Junaid Ali Silver
2004 Kamran Hussain Gold
There are probably a lot of ways to do this. First make sure the data is cleaned. If you are already 100% positive the data is clean you can skip this step. If you aren't sure it's better to be safe than sorry. For each column create a new column using the CLEAN and TRIM functions to remove any non-printable characters and any extra spaces. Something similar to =TRIM(CLEAN(A2)). Then drag the formula for each cell.
After this in order to merge the data together we need something to join on. The full name seems to make the most sense. On sheet two we'll write a new function to join the first name and last name together. The =CONCAT formula should work.
=CONCAT(First Name, " " ,Last Name). Make sure to note the extra space added by the quote. That way it matches the Full Name from Sheet 1. Looks like we'll also need to strip out the letter from Order ID in sheet 2. I'm going to assume that all Order IDs are 5 characters long. If this isn't true then you'll need a different solution. You can use =RIGHT(A2,4). This will grab the right 4 characters from the text string.
At this point let's create a distinct list. Copy the Full Names from Sheet1 and Paste them on to sheet 3. Copy the Full Names we created on Sheet2 and Paste VALUES onto sheet 3 below the full names from sheet 1. Then select all the rows in the column and go to the Data tab. Click "Remove Duplicates". This will now generate a distinct list of values.
We can now merge the data together using an INDEX MATCH. There are lots of great tutorials on how to use INDEX match in combination. It's a little long to explain on this thread, but this is a great thread explaining how it works. It's worth taking 10 minutes to fully understand it because it is a formula you will use thousands of times throughout your life.
https://www.deskbright.com/excel/using-index-match/
Let me know if I can clarify anything.
Best,
Brett

Excel - rearrange rows with same columns value into columns in the same row

I have data from other software that outputs in the format shown attached. This is what it initially looks like. I have removed data from all other columns that were not relevant to this task (i.e. columns A - H, J, K, M, N and P).
All items have different ID #s. However, each item has the same categories. Each category can have between 1 and 3 values, either numerical or alphabetical.
The actual data I'm working with has close to 500 items.
I'm looking for a way to rearrange the data so it looks like this.
In response to a comment:
I want to do several things
1. Move everything over to start at A1; in a separate sheet is good
2. Rearrange data so the only columns are ID | CAT | Value 1 | Value 2 | Value 3
3. Have each CAT only listed once for each item
4. Move each Value with the same ID and CAT to be listed on one row
If any further elucidation is needed, please inform me.
Thanks to all!
Have you tried creating a PivotChart on a separate sheet and filtering out the blanks?
Or, have you considered filtering the information?
I think we might need some more clarification -- from your message, it seems like you just want to create headers and delete the blank rows/columns.

Excel: View clients who don't have a product

I have a table of clients and the products that they have purchased.
I'm looking for a simple way of being able to filter to view all clients who don't have a certain product.
Client | Product
------ | ------
John | A
John | B
John | C
Kate | A
Kate | B
Kate | D
Mary | A
Mary | D
With the above example I would want to look for which clients do not have Product -> C, the return I'm after is Kate and Mary.
I've tried looking at this in a few different ways but I feel I'm over complicating it. I was creating a table to return who has the product then doing a lookup from there against another table of all users to then find out who wasn't in the first list.
I tried using a pivot table to get what I was after but I'm only able to return who has the products rather than who doesn't, also filtering product C from the pivot table does not help as the Client still shows up having other products.
I'm hoping there is an easier way to do this.
Your assistance is appreciated.
Dane
COUNTIFS should to the trick here.
You have one cell where you enter the product to look for. Then you add a column to your table that checks if the client does not have that product.
=COUNTIFS([Client],[#Client],[Product],referenceToTheProductToLookFor)=0
This will count the rows where
the entry in the column "Client" is the same as the value in the column "client" in the current row ([Client] references the whole column, [#Client] only the current row's value of that column)
the entry in the column "Product" is the same as the one entered in your input cell
and checks if the resulting count is 0. If it is 0 the cell value will be TRUE, otherwise it will be FALSE.
If you want to avoid having to make two steps each time you change the product you are looking for (1. enter the product, 2. update the filter on the table) you could use the worksheet's On_Change macro to detect changes to the product code and then automatically update the filter on the table.

Searching in Excel for certain values, if found give text from cell to the left of where we found the value

First let me explain what I want to achieve.
I currently have an Excel like this:
Names | Standards
James | Standard 1
James | Standard 2
James | Standard 3
Francis | Standard 1
Francis | Standard 2
Francis | Standard 3
Leon | Standard 2
Leon | Standard 3
Peter | Standard 2
Michael | Standard 3
And I want to create something like this:
Standard | Name 1 | Name 2 | Name 3 | Name 4
Standard 1 | James | Francis | |
Standard 2 | James | Francis | Leon | Peter
Standard 3 | James | Francis | Leon | Michael
My real Excel has more than 300 standards, so I would like to automate this using Excel Formula. I know this is possible, but I haven't used Excel in a while, so I could use a push in the right direction.
Couple of things I need (I think):
Need to count how many times people in the names column mention a standard. So I want to know that I need 2 names for standard 1 and 4 for standard 3. I think I can do this by using the COUNTIF method.
We need to search for the location of the standards. I think I can do this by using the Match function. This gives us the location of the first match in my original Excel. By sorting my original Excel a-z and combining it with the countif result I know where all the matches are (first match + countif = location of the last match, and everything inbetween is also that standard).
For the first name that mentioned a standard, I will reference the cell left of the first match (because the names are in the cell to the left of the standard I found). For the second name I will reference the cell left of the cell below the first match. I keep doing this till I find as many names as Countif mentioned. So I need an IF statement that makes sure that if 2 people mention standard 1 only gets 2 names and 2 cells with a "".
How will I reference the cells? By another if statement that uses this: Excel Reference To Current Cell , Correct me if I am wrong, but can't I then just say THIS.CELL=cell location I found (probably should use INDIRECT here?).
This is just me brainstorming, but I would love to know if people have any other ideas for my problem or have some feedback for my current plan.
An important thing to mention is that I want to do this using Excel Formula. I do realise that this isn't always the best, but VBA is not an option atm. I am also not worried about performance issues, because I think i'll just copy all the values after I found all the names using formulas.
Thanks in advance!
Depending on how you want to have the layout, I think you should use a pivot table. Drag the 'Standards' and 'Names' fields to the 'rows' data box and then right-click on a standard, click 'Field Settings' - 'Layout and Print' - 'Show item labels in tabular form'. (See example below.)
If you definitely need the data in the format in your question, I would edit the pivot table by dragging the 'names' field to the 'columns' data box. Then drag the 'standards' field from the field list above a second time and duplicate it in the 'values' box (see example below).
In the space underneath the pivot table, use an IF formula to only copy the name if there is a 1. This kind of approach will obviously be quite fragile, so if you can make do with the first approach, I think you will run into fewer problems in the future.

Resources