I have an excel spreadsheet with delimited information (tracking #s) in various rows:
row a 630521*630621*630215*610517
row b 630522*630611
row c 630531*630651*630265
row d 630524
I would like to organize all rows of tracking #s, separated by a "*", into one column. Can you tell me how this is possible? I have 4,000+ rows like this with up to 21 tracking #s (variable) in each row that I want to convert to one column with multiple rows.
col a
630521
630621
630215
610517
630522
630611
630531
630651
630265
630524
You can do it all in Excel:
Highlight your column
On the Data menu, select Text to Columns => Delimited => Next => Other * => Finish
Then Copy/Paste each of the resultant columns into a single column and sort it to put the blanks at the bottom.
To save step 3. in Ron Smith's answer where you have a LOT of rows, you might add a blank row at the top and on the left, select you entire range (including all the blanks), apply the technique detailed here, delete the columns labelled Row and Column then filter to delete blank rows from column labelled Value.
Related
I am trying to lookup values from Table 1 to Table 2 based on Col1 in Table 1.
The catch is that Table 1 has duplicate values (for example, A is repeated 3 times) but I don't want to duplicate the returned value from Table 2.
How can this be done through either excel or sql (e.g. LEFT JOIN)?
What SQL are you using? Are you familiar with CTE and partition?
Have a look here: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/597b876e-eb00-4013-a613-97c377408668/rownumber-and-cte?forum=transactsql
and here: (answer and 2nd comment): Select the first instance of a record
You can use those ideas to create another field that tells you whether the row is the first, 2nd , 3rd etc occurrence of Col1. Eg you'd have something like
1 B Red 150
2 B Red 150
and you can then update col3 to be zero where this new field is not 1.
EDIT: since you asked about Excel: in Excel, sort by whatever criteria you may need (col 1 first, of course). Let's say that Col1 starts (excluding the heading) in cell C2. Set cell B2 =1. Then write this formula in cell B3:
=IF(C3=C2,B2+1,1)
and drag it all the way down. This will count the occurrences of col 1, ie it will tell you which is the first, 2nd etc time a given value appears in col1. You can then use it as as the basis to change the value in other columns.
Also, it is not good practice to have a column where the first cell has a different formula from the others. You can use the same formula nesting another IF and referencing the row, so as to set one formula for the first row and one for the others.
The challenge here is the sentence is not split by cell. They are in the same column, but they might appear in the same cell. One sentence per line.
I need to count the occurrence of each sentence, for example, occurrence of "The cat is pink" is 2 and occurrence of "The dog is green" is 1.
I can also do Access 2016 if needed.
(Assuming you can split multi-sentence cells into multiple cells)
1) Split the cells with multiple sentences, you should be able to adapt this code to do this.
2) Make a copy of the column (elsewhere on the same sheet or in another sheet -- used column B in the same sheet),
3) Remove duplicate values for the copied column
4) Next to the column use the following array formula:
{=SUM(LEN(A$1:A$5)-LEN(SUBSTITUTE(A$1:A$5,B1,"")))/LEN(B1)}
(press <CTRL><SHIFT><ENTER> when entering an array formula)
sort column A --> a-z then
add a header to column A (to use in subtotals)
then from the Data tab, use "subtotals" using "count" as the function
=COUNTIF(A:A,"*Cat is Yellow*")
The same formula can be applied for all the rows.
I have a table with source data in columns Regions!A6:R553.
In Regions!A3:R3, I have formulas that pull specific information out of my data table in Regions!A6:R553 that I want copied to a different sheet.
Column A acts as my project name column, while column B holds ID numbers. In my case, there are multiple ID numbers per project.
I am looking for a script to filter and loop through all the unique order numbers in Column B one by one, then copy cells A3:R3 to RegionsSummary!A12:R12 for as many rows as there are unique order numbers (i.e, add rows to the table).
Here is a screengrab of my data sheet, "Regions":
i.stack.imgur.com/aTPuw.png
Here is a screengrab of the empty template sheet "RegionsSummary":
i.stack.imgur.com/9Ukz5.png
Example: Assume there are 5 projects in my data sheet. I will filter the data using another macro to select Project_1. I would then like a command button to active a macro that will filter to the first order number in Column B, copy Regions!A3:R3 to RegionsSummary!A12:R12, then filter to the second order number in Project_1, and repeat the process. This should go on until all unique ID numbers have been filtered and looped through.
Here is a screengrab of what a final product should look like:
i.stack.imgur.com/9Ukz5.png
Here is a link to the file: Final Output Example
I would go with an easier solution than a Macro with certain constraints. I am not able to access your sheet, so I will make a sample excel.
STEPS:
Create a list of unique projects for a dropdown (COPY Regions!A5:A10000 to a new sheet > Data > Remove Duplicates) . Create the dropdown (Data Validation > List > Select Range) using Data Validation in "Example_Result" sheet- C7.
In "Regions", in Col S, put the below formula
=S6&"_"&COUNTIF($S$6:S6,S6)
Copy this formula down for the entire sheet or as long as you expect the sheet to grow
In "Example_Result", insert an index column (1 to 1000, in Col A if you expect each project to have 1000 or less order numbers) from A12 onwards.
Along the columns (B onwards) of Row 11 include the names of the variables from Regions (Assessment Project, Highway etc).
Insert the below formula in B12 to S1000 (depending on number of variables) of Example_Result:
=IFERROR(INDEX(Regions!$A$5:$S$10000,MATCH($C$7&"_"&A$12,Regions!$S$5:$S$10000,0),MATCH(B$11,Regions!$A$5:$H$5,0)),"")
I have a very large Excel spreadsheet that looks like this:
However, I want to move every cell in the second column that starts with Location to the next column.
So it would look like this:
No need of VBA
Enter this formula in C2 and copy till last record
=IF(LEFT(B3,9)="Location:",B3,"")
Then copy paste values in column C, filter column B for Location:* and clear the resulting cells in column B or delete the rows (do as needed).
I would copy column B, paste it in column C then select C1 and press ctrl-- (CTRL and Minus together)
Select shift cells up and click OK.
Then either sort by column A or filter out any with a blank in column A.
You can also use this:
=IF(ISNUMBER(SEARCH("Location",B2)),B2,"")
Then apply conditional formatting to your data range as following:
Final Result
I have 10,000 rows and unlimited data in columns. Two parameters in adjacent columns and are repeating after 13 unwanted columns.
I want to concatenate these adjacent columns of a row separated by space
eg:
concatenate(B2,C2,"",P2,Q2,"",AC,AD,"",....)
But I dont know upto which column the data is present.
Can you suggest me a macro which concatenates data upto blank column in one cell of a row and same is continued for first 10,000 rows.
Thanks a lot for help !
First off, are all the rows terminating at the same column? i.e. does every row have data in column AD but not AE?
If the answer to the above is 'yes', then you'll probably want to take a look at:
Range.End()
which is used like:
YourSheet.Range(YourRange).End(xlToRight).Column
(see here for more info)
This will return either
the last column with data (when the starting cell contains data)
or
the first column with data (when the starting cell is empty).
not the last column without data!
Based on your example in the question, your ranges probably start in Column B, P, AC, etc.
If the answer to the above is 'no', then you can use similar functionality, but you'll have to loop through each row...