Excel: Convert single column of repeating text into multiple rows - excel

Easy excel question? (I've looked, and looked...)
How do you take a single column with groupings of TEXT (e.g. A1:A5, A6:A10, A11:A15) and convert those groups into rows (e.g. A1:A5 converts to B1:F1; A6:A10 converts to B2:F2) Thanks. (Note: can't upload image b/c I'm new)
Here's a text example:
CURRENT:
(Convert this column (2000 entries in groups of 5))
Trinity
Neo
Morpheous
Agent Smith
Oracle
Dozer
Mouse
Zion
Nebuchadnezzar
The Twins
REFORMATTED:
(Data in rows from the groups of 5)
Trinity | Neo | Morpheous | Agent Smith | Oracle
Dozer | Mouse | Zion | Nebuchadnezzar | The Twins

With data in column A, in C1 enter:
=INDEX($A$1:$A$2000,COLUMNS($A:A)+5*(ROWS($1:1)-1),1)
Then copy C1 to D1 through G1
Then copy C1 through G1 downwards. For example:

Obviously Gary's way is much quicker , but an easy to understand but dirty way is to do like so
Add Formula's like so( if you are not putting a header row in , then use =MOD(ROW(A2),5)
The data will look like so
Then filter to 1 on the last column

Related

How to fetch cell value through user-defined header name

I have an excel table, like this
| DOG | CAT | COW | CHICKEN ...
------+-----+------+------+------
FARM1 | 2 | 0 | 4 | 80
------+-----+------+------+-------
FARM2 | 0 | 3 | 12 | 125
------+-----+------+------+-------
......
Is it possible to get the value through the customer headers instead of A2, B2?
I want to be able to fetch the value like so
=FARM1DOG
Is it possible to do that?
What you are describing could be done a few ways. I would prefer index(match(...
Assuming your table above is in the top-left corner of the spreadsheet and continues to J10 you could use:
=INDEX($B$2:$J$10,MATCH("FARM1",$A$2:$A$10,0),MATCH("DOG",$B$1:$J$1,0))
On the other hand, you could do it with named ranges as well, but the names would need to be changed if the column headers changed. Just name each entire column after it's header. So select column B and create a name for the range called "Dog", then the same for all the other columns. Then for the rows name row 2 "Farm1", etc...
Then you can use:
=FARM1 DOG
(the space between them is the intersect operator)
Under presumption that your data is small you can also name the Range manually:
Select the cell you want to name
Formulas -> Define Name [ CTRL + SHIFT + F3 ]
Call it whatever you want
Now you can refer to the cell by the given name:
EDIT:
Alternatively, you could also name the headers only and refer to it via =OFFSET.
=OFFSET(<VERTICAL NAME>,,COLUMN(<HORIZONTAL NAME>) - COLUMN(<VERTICAL NAME>))
In a practical example
=OFFSET(farm1,,COLUMN(dog) - COLUMN(farm1))

Count or Sum (?) items in a single cell that match criteria from a list in Excel

I have a single cell that is the output of a survey, that contains items selected from a list of 20 possible items.
ie.
Original possible selections:
Ape, Blue, Cat, Red, Dog, Yellow, Pig, Purple, Zebra
User is asked to "select all of the animals," from the list of possible selections. The output places all of the items they've identified into a single cell, separated by commas.
A new row is created for each survey entry.
ie.
| User 1 | "Ape, Cat, Pig, Purple" |
| User 2 | "Cat, Red, Dog, Pig, Zebra" |
| User 3 | "Ape, Cat, Dog, Pig, Zebra" |
etc...
I have a table with all of the animals and colors, with defined ranges.
ie. animals = A1:A5, and colours = B1:B4
I need to "score" the cell for each user, in a new cell. Where the score value is the count of the number of correctly identified items each counts as 1 point.
ie.
| User 1 | "Ape, Cat, Pig, Purple" | 3 |
| User 2 | "Cat, Red, Dog, Pig, Zebra" | 4 |
| User 3 | "Ape, Cat, Dog, Pig, Zebra" | 5 |
What would the formula need to be for that score cell for each row?
I found a previous thread, that seems to point in the right direction,
Excel: Searching for multiple terms in a cell
But this only checks for the existence of any of the items in a cell from a list and returns a true or false
Thanks for anyone's help!
COUNTIF with SUMPRODUCT:
=SUMPRODUCT(COUNTIF(D2,"*" & $A$1:$A$5 & "*"))
Which also has the limitation of the amimals not being a sub-string, like Ant and Ant-Eater
If sub-strings are a problem then use this:
=SUMPRODUCT(--(ISNUMBER(SEARCH(", " & $A$1:$A$5 & ", ",", " & D2 & ", "))))
This will make a complete match between the commas.
The formula shown is entered in D3 (an array formula, so use Ctrl+Shift+Enter) and filled down to D5
A3:A6 is a named range "animals"
Note this is only reliable if none of your terms are sub-strings of another term.
If you do not like to use the formulas above, which are very efficient and most ideal, a simpler but longer way would be as follows:
select the animals--> Data--> Text to Columns, and split them into columns with the separator being a comma
Once this is done, do a countif on each column, and it will total it up for you. You will need to do 20 countifs though, so it is far from ideal
IE
=countifs(column which it could be in],[no.1 animal])+
countifs(column which it could be in],[no.2 animal])+...
countifs(column which it could be in],[no.20 animal])
This is easy to see how it works and if you receive more answers you will have to split them out again

Excel: Create new Row for each column

I have a data set as follows:
A | B | C |...
1abc | 1def | 1ghi |...
2abc | 2def | 2ghi |...
...
This is a collection of memo notes for each account in our database. The 1 in "1abc" represents the account ID and the letters represent some text. There are a total of 177 columns and 1866 rows but not every row has values up to column 177, some may only have two columns worth of data.
I need each column to drop down to the bottom of column A so that all data only occupies Column A. For example, all the data in column B would inserted after the last value in A. Data in column C would be inserted after the last value in column A after it's been populated with the data from B and so on.
In the end, it should look something like this (from which point I can simply sort it in ascending order).
A | B | C |
1abc | | |
2abc | | |
...
1def | | |
2def | | |
...
1ghi | | |
2ghi | | |
...
Can anyone help out with this? I am assuming that I need a macro and have tried working with the solution found in this post but couldn't figure it out. Oh, and I'm using Excel 2003 if that helps.
I am not sure if this will help but, from what you have given me, it sounds like you have 3 columns of data that you would like to be put into one column. If I am correct in my thinking, you can do this a few different ways. So as to preserve the original document in its entirety while adding an extended sorting system you could: 1: Create new tab. Then highlight range a with your mouse. Using your mouse right click and select copy (try to keep in mind the value of the range, E.g. How many items have you copied. Paste it in your now tab. Do this for the remaining ranges. Or maybe use V look up. If you would like I have a schedule module I have created that has many different types of range associations. You can also split sting in excel to divide the id from the sting.
Without VBA, add a blank row at the top and a column on the left populated throughout with say x and then follow the steps detailed here. Then delete the left-hand two columns and filter the remaining one to remove any blanks.

Compare multiple columns, pull out only cells that appear in every column

I have 10 or so columns in my worksheet. Each column contains about 200 names, and there is no other data on the sheet.
What I'd like to do is create a new column that only contains the names that are common between the columns. So essentially compare each cell in each column to all the other cells in all the other columns, and only return the the common cells.
For example:
Column1 : name_A, name_C, name_F
Column2: name_C, name_B, name_D
Column3: name_C, name_Z, name_X
So in this example, the new column would only contain name_C, because it's the only value common to all three columns.
Is there any way to do this? My knowledge of Excel is quite poor, and I can't find anything similar to my problem online so I would appreciate any help.
Thanks for reading,
N
Put everything on a single spreadsheet and create a pivot table is probably more efficient than the algorithm you have on your mind.
here is my mock-up. I added extra names to demonstrate better
D(formula) has the easiest version. this will list only values that appear in all columns, but these will appear on the same lines as the corresponding name in column A, with blanks, and not sorted (giving D(result))
IF you would like all the names to appear the the top - as shown here in column E you can either sort your table (you will have to re-sort if the columns change) OR you can use my solution below:
get yourself the MoreFunc Addon for Excell ( here is the last working download link I found, and here is a good installation walk-through video )
once all is done select cells E1:E8, click the formula bar and type the following: =UNIQUEVALUES(IF(COUNTIF(A2:C9,A2:A9)=3,A2:A9,""))
accept the formula by clicking ctrl-shift-enter (this will create an array-formula and curly braces will appear around your formula)
A B C D(formula) D(result) E(result - sorted)
-------------------------------------------------------------------------------------------------------
1 | name_A name_C name_C =IF(COUNTIF($A$1:$C$8,A1)=3,A1,"") name_m
2 | name_C name_B name_Z =IF(COUNTIF($A$1:$C$8,A2)=3,A2,"") name_C name_C
3 | name_F name_D name_X =IF(COUNTIF($A$1:$C$8,A3)=3,A3,"")
4 | name_t name_o name_g =IF(COUNTIF($A$1:$C$8,A4)=3,A4,"")
5 | name_y name_p name_h =IF(COUNTIF($A$1:$C$8,A5)=3,A5,"")
6 | name_u name_k name_7 =IF(COUNTIF($A$1:$C$8,A6)=3,A6,"")
7 | name_i name_5 name_9 =IF(COUNTIF($A$1:$C$8,A7)=3,A7,"")
8 | name_m name_m name_m =IF(COUNTIF($A$1:$C$8,A8)=3,A8,"") name_m

Match text from column within a certain cell - Excel

I have a column of few thousand filenames that are not uniform. For instance:
| Column A | Column B |
===============================
| junk_City1_abunc | City1 |
-------------------------------
| nunk_City1_blahb | City1 |
-------------------------------
| small=City2_jdjf | City2 |
-------------------------------
| mozrmcity3_somet | City3 |
I would like to identify the city within the text in column A and return it in Column B.
I've come up with a complex formula that does the trick, but it is difficult to adjust if more cities are added within the filenames in new entries within column A.
Here is an example:
=IF(ISNA(MATCH("*"&$W$3&"*",I248,0)),IF(ISNA(MATCH("*"&$W$4&"*",I248,0)),IF(ISNA(MATCH("*"&$W$5&"*",I248,0)),IF(ISNA(MATCH("*"&$W$6&"*",I248,0)),IF(ISNA(MATCH("*"&$W$7&"*",I248,0)),IF(ISNA(MATCH("*"&$W$8&"*",I248,0)),"Austin","Orlando"),"Las Vegas"),"Chicago"),"Boston"),"Las Angeles"),"National")
It seems like there should be an easier way to do it, but I just can't figure it out.
(To make matters worse, not only am I identifying a city within the filename, I'm looking for other attributes to populate other columns)
Can anyone help?
Use the formula =IFERROR(LOOKUP(1E+100,SEARCH($E$2:$E$11,A2),$E$2:$E$11),A2)
This does *****NOT***** have to be array entered.
Where $E$2:$E$11 is the list of names you want returned and A2 is the cell to test
If no matches are found instead of errors you will just use the full name in column b.
If you want errors or expect to NEVER have then you can just use:
=LOOKUP(1E+100,SEARCH($E$2:$E$11,A2),$E$2:$E$11)
Here's a round about way that works, not all my own work but a mish mash of bits from other sources:
Assuming the sheet is setup as follows:
The formula to use is below, this must be entered using Ctrl+Shift+Enter
=INDEX($C$2:$C$8,MAX(IF(ISERROR(SEARCH($C$2:$C$8,A2)),-1,1)*(ROW($C$2:$C$8)-ROW($C$2)+1)))
Annotated version:
=INDEX([List of search terms],MAX(IF(ISERROR(SEARCH([List of search terms],[Cell to search])),-1,1)*(ROW([List of search terms])-ROW([Cell containing first search term])+1)))

Resources