Macro To Join Two Columns With Delimiters?
Jan 14, 2014
I'm trying to write code to join two columns of data, and then join all of those into one cell.CA
California
DE
Delaware
CT
Connecticut
I want to be able to run the macro and have it put {"CA":"California","DE":"Delaware","CT":"Connecticut"} into cell C1.
I was thinking that this would have to be a two part macro. First, it would take each specific row and join CA and California and add the colon, quotation marks, and the comma, and put it Column C. Then, after it's gone through every row, it would join every cell in column C together.
This is what I've written so far:
VB:
Sub test1()
Dim r As Range
Dim lr As Integer
[Code]....
Now I need to figure out the second part. How do I then take all of the join cells in column C and join them together, adding the curly braces at the beginning and the end, and removing the comma from the very last row?
View 4 Replies
ADVERTISEMENT
Apr 17, 2008
I have a column full of text with most data separated by commas, except sometimes between the commas there is a string, marked by ' ' , which itself contains commas.
For example: 45,'im a string, look at me',67,43,5,'im another string, look at me',78
I try to make excel put all the data into columns, so 'im a string, look at me' will have its own column, instead of being split into two columns. I tried telling excel that the ' character marks strings, but it just removed the apostrophes and kept splitting any string that contained a comma. I tried to use a special delimiter,' but excel didn't allow me to. Does someone have a macro that will do the text to columns for me, or is this possible to do with the regular text to columns feature of excel?
View 2 Replies
View Related
Apr 8, 2013
I have a column within a spreadsheet that has data separated by 2 delimiters, a "" and a "/". (This data has been extracted from a linux-based file.)
For example: "1100789/3200899/6xlm-sgt-455-0987"
The items of data are from a bill of material (parts explosion) and the number preceding the "" is a quantity and the numbers preceding the "/" is a sub-part number of the main part number that is entered into a column to the left of this data string. (unseen in the example)
I need to take this string of numbers and place the quantity in one column, the part number in another column, then add a row and continue to populate each column until the data has all been separated, then move on to the next main part number row to continue the process.
for example:
1 100789
3 200899
6 xlm-sgt-455-0987
Is this possible with the data tools in a spreadsheet, or will I need to write a macro?
View 9 Replies
View Related
Sep 29, 2009
I need to import a number of log files into a spreadsheet, each log will go into a separate tab. The logs are text files (.log) that have the same structure but slightly differ from each other.
For example all the logs will have many lines of data all starting with a date and then a number of delimited fields. In some logs the delimiter is a coma, in others is a unique charachter such as "{" or "@". Also the delimited fields are not a given quantity, they can vary too from log to log. How can I write a macro that understands what delimiter needs to be used and then imports all the file accordingly into one spreadsheet (in separate tabs)?
I tried something with the macro recorder and browsed for directions on the internet but really am clueless on this one. I am using windows 2000, and referenced Windows Scripting Runtime.
View 3 Replies
View Related
Apr 8, 2014
I have the cell data as below
How would I split into a new column the first part which is a date into a new column, then the country and the remainder into separate columns?
I still want the original data as I need to check that the splits worked well?
16.5.90 CH 1671/90-4
18.10.1991 CH 3056/91-1
24.07.92 ch 2341/92-2
30.7.92 ch 2395/92-3
18.11.92 Us 3533/92-5
26.5.93PCT 1577/93-0
9.8.93 CH 2363/93-8
17.8.93 CH 2445/93-0
25.1.94ch209/94-6;8.12.94ch3714/94-1
25.1.94 ch 209/94-6 ; 8.12.94 ch 3714/94-1
8.4.94 ch 1047/94-0
22.4.94 ch 1255/94-7
18.11.1992 CH 3533/92-5
18.11.1992CH 3533/92-5
View 2 Replies
View Related
May 31, 2012
I have a list containing hundreds of rows and I need to join the cells in different columns.
Eg. Col A, Row 1 is "Red Maple"
Col B, Row 1 is "Acer Rubrum"
Col C, Row 1 is "60mm"
I need to join the row into one cell reading "Red Maple Acer Rubrum 60mm"
View 2 Replies
View Related
Jan 11, 2008
how to add two columns of single words together, so that all possible word combinations are seen. For example:
Column1:
Horse
Pig
Dog
Sheep
Column2:
Run
Walk
Sit
Roll
So... I'd like Column3 to look like this:..........
The issue is I have about 100 words all together so there will be a lot of results! Is there a way I can enter a formula to do this?
View 2 Replies
View Related
Jan 6, 2009
I wish to join few columns from two data sheets using Macro function.
Sample
Sheet 1:
A B C D E
1 Headline Msg1 Msg2 Msg3 Msg4
2 Car Post Join Help AAA
Sheet 2:
A B C D E
1 SumNo Msg1 Msg2 Msg3 Msg4
2 CM001 Join Help AAA BBB
Output;
A B C D E F
1 Headline SumNo Msg1 Msg2 Msg3 Msg4
2 Car Post Join Help AAA
3 CM001 Join Help AAA BBB
View 4 Replies
View Related
Aug 22, 2007
I am trying to join 2 tables which have identical columns. The columns are:
A B C D E F
Date : Name : ID : Violation : Date Sent : Comments
Table 1 has information in columns A-E, Column F is blank
Table 2 has information in columns A-F.
I want to be able to check the information in Columns A-E in both tables and add the information in Column F from Table 2 to Table 1 where Columns A-E are an exact match.
View 9 Replies
View Related
Feb 9, 2008
I have a marco that works perfects to Concatenate (join) all of the cells in Column A. However, I want to seperately join all of the cells in each column. So I wanted to the Concatenate of Column B to go in B1, Column C to go in C1, etc (or until there is no data in a column). I think there is a way to change this into a loop, but I don't know how. Below is the macro I have now.
Sub ConcatenateAll()
Dim x As String, rng As Range, cel As Range
With ActiveSheet
Set rng = .Range("A2:A300")
For Each cel In rng
x = x & cel.Value
Next
.Range("A1").Value = x
End With
End Sub
View 2 Replies
View Related
Apr 2, 2007
apSheet.Range("A2").Formula = "=D2&E2&F2"
I am trying to do the same kind of formula with a user form where the user is picking the range for the needed columns. I am not sure how to make it work.
Private Sub test()
'declare variables
Dim wb As Workbook
Dim iSheet As Worksheet
Dim apSheet As Worksheet
Dim glSheet As Worksheet
Dim x As Long
Dim apA, apB, apC, apD, apE, apF, apG, apH, apI, apJ
Dim LstAPRow
'set variables
Set wb = ThisWorkbook
Set iSheet = wb.Worksheets("Instructions")
Set apSheet = wb.Worksheets("AP Query")
With apSheet
LstAPRow = Range("A65536").End(xlUp).Row
End With..............................................
View 9 Replies
View Related
Sep 21, 2009
I have a sheet that is going to list usernames in a range of cells (e13:e19). Who gets listed there depends on another condition. So, all the cells could have a name, or only a couple of them could have a name. In another cell I have a formula that is to concatenate the results of who is in e13:e19 range, each name to have a comma between. The problem results when not all of the cells have a name .. the commas still appear ... so results could be ted, mary, bill,,,,bob, jeff ..etc.
I am using the formula below but it still allows the non-needed commas to appear:
=MID(IF(ISTEXT(E13),","&E13,"") & IF(ISTEXT(E14),","&E14,"") & IF(ISTEXT(E15),","&E15,"") & IF(ISTEXT(E16),","&E16,"") & IF(ISTEXT(E17),","&E17,"") & IF(ISTEXT(E18),","&E18,"") & IF(ISTEXT(E19),","&E19,""),2,2000)
View 3 Replies
View Related
Sep 21, 2009
It was being able to concatenate a list of names with commas between names. The resolution was: =Substitute(Trim(E13&" "&E14&" "&E15&" "&E16&" "&E17&" "&E18&" "&E19)," ",",")
This worked great until my boss said "I want first and last names. Now someone whose name makes the list is shown as john, smith.
View 5 Replies
View Related
May 1, 2008
I'm trying to split a cell with 2 different delimiters.
As example
A1 10'48"
to
B1 10
C1 48
I have about 10.000 entries like those. And i think a macro should be the most suitable for it.
But I'm not experienced enough to make it work.
View 3 Replies
View Related
Oct 3, 2011
Having some problems splitting data within a single column into several using VBA rather than a Formula. (I have been able to get working using a formula). I have found a few similar theads but nothing i seem to be able to convert with my some what limited skills
My data is always in a sheet called "Release Data" in column A, the number of rows varies daily. The data is always extracted with the delimiters in the same position E.G.
NNNNNN_AAA_Variable length txt
I would like to split the data into columns I, J and K.
View 2 Replies
View Related
Jan 9, 2008
I have a spreadsheet which performs certain operations as long as I insert 3 values in 3 cells. The results for different scenarios are shown within the same sheet. excample:
I insert
3,52,051,22
then many calculations are performed automatically and the result are shown in other cells in the same sheet.
My goal is to be able to copy/paste ca 8-10 strings of information at the same time. All of them at the same time, instead of only one at the time. Also, there will be a textstring and some digits I don’t need along with the copy/pasted info.Ex:
Name Time Date X1 X2 X3
Lou 22.11 01.03.2006 3,5 2,05 9,72
Lie 12.01 01.03.2006 2,5 2,65 1,22
Tom 17.09 01.03.2006 4,5 8,09 3,28
etc.....................................
View 2 Replies
View Related
Feb 27, 2014
I have a set of data in column A that looks like this:
White:0:0|Counter Height:0:0|Orange:40:0|Counter Height:40:0|Green:40:0|Counter Height:40:0|White:40:0|Bar Height:40:0|Orange:80:0|Bar Height:80:0|Green:80:0|Bar Height:80:0|
The delimiter "|" separates the unique values of an item (in this example they are dining stools of differing heights and colors), I need to only keep the lower value and remove the larger one.
The example above contains both White:0:0 and White:40:0 as two different values associated with the same dining stool. I need to only have White:0:0 remain and White:40:0 to go away.
View 2 Replies
View Related
Nov 19, 2013
I am trying to consolidate an .835 raw text file that is full of receipts and payments into rows by specific values/characters. Once opened within notepad/text format, I figured out that the ~CLP is the referencing value/character used to break up each individual payment.
I need to somehow use the ~CLP as the value(s) to sort the text into new rows, with each row pre-leading with the ~CLP.
For example:
~CLP*442.24*DTM*B6*PR~CLP*124.32...etc
New Row format needed:
~CLP*442.24*DTM*B6*PR
~CLP*124.32
View 6 Replies
View Related
Aug 6, 2012
I need to "convert" Excel table to TXT or CSV file, but delimiters have to be ";" and text must be in quotation marks "".
View 1 Replies
View Related
Jan 30, 2014
I would like to extract multiple numbers from a single cell. The cells contain -, /, and blank spaces are delimiters. An example is 4 - 3 1/4 and because of the way they use that number, it really means 4 inches and 3.25 fifths of an inch (3.25/5 inches) which is weird. I want to go through each cell and store the 4, 3, and 1/4 as variables so I can then manipulate to convert them to the proper inch value (I can perform the conversion code, I just need to know how to set those variables in the cell). And I would like it to automatically do it when a cell has been changed. formatting to maintain overall table width dimensions so if you know anything about that,
both cells are blank
4 - 3 1/4
cell value is enter in on the left
4 - 3 1/4
4.65
converted cell value appears on the left
View 2 Replies
View Related
Jul 17, 2014
I have on sheet1 a number (72 at the moment) of Form CheckBoxes.
In simple terms: I would like a macro to look at each CheckBox and remember its state (Checked or Unchecked)
Then, go through and Check All checkboxes
Call MyMacro
Once MyMacro is complete (Filtering & Printing)
Revert the checkboxes to their original state.
The purpose of the checkboxes:
When Checked column on sheet2 is UnHidden
When UnChecked column on sheet2 is Hidden
Or, UnHide All columns on sheet2, run MyMacro, then "re-hide" the columns that were previously hidden.
View 11 Replies
View Related
Aug 10, 2008
how to join two tables which their relationship is one column in A table inclue another column in B table.
for example:
Table A:
ColumnA1
ColumnA2
Table B:
ColumnB1
ColumnB2
I want to join Table A and Table B, and the where clause should be A.ColumnA1 include B.ColumnB1.
Like the value of A.ColumnA1 is "Abc1234 test", and the value of B.ColumnB1 is "1234", and then we can join the TableA and Table B
View 14 Replies
View Related
Dec 6, 2007
I'm writing an Excel Macro and want to sum a number cell with the value "45667" and a text cell with the value "Prague" and return it to a new cell with the value " 45667 Prague"
I've done it successfully with the two text cells "John" and "Hopkins" to "John Hopkins".
This is my
Sub SumCells()
Dim FirstName, SecondName, Zipcode, City, fullname, fulladdres, space
FirstName = range("cell1").value
SecondName = range("cell2").value
Zipcode = range("cell3").value
City = range("cell4").value
space = " "
fullname = firstname + space + secondname
fulladdress = zipcode + space + city
The problem is that city is recognized as "Prague", and the zipcode as 45667 (without the "")
View 3 Replies
View Related
Feb 21, 2009
what I'm after is a macro to check the contents of Column 'A' against column 'B' and display any duplicates in Columns 'C' & 'D'.
N.B. The headings of Columns C & D are :-
C = Value Found in Column A
D = Value Found in Column B
Any duplicate entries logged in columns C & D should be listed in C2,C3,C4....C20 and D2,D3,D4......D20 etc (in effect creating two new lists)
View 5 Replies
View Related
Apr 23, 2014
I have file with so many columns and i want to keep only columns i want.
Data
genredyellowgreenwhiteblue
1aaggttccbb
2aaggttccbb
3aaggttccbb
4aaggttccbb
5aaggttccbb
expected
genredwhite
1aacc
2aacc
3aacc
4aacc
5aacc
for example here i want to keep only gen, red and white columns only out of columns what i have in my data. I have so many columns in my original data but here i given just small example. How to proceed with macro or any other way because removing manually taking long time for me.
View 6 Replies
View Related
May 26, 2014
We have approximately 100 rows x 200 columns of data and would like to combine the contents into one row. Is this possible without copying and pasting many times.
eg
1 abc dek jui kol
2 ppo adf asd dfa
into one row
1 abc dek jui kol ppo adf asd dfa
View 3 Replies
View Related
Jun 9, 2014
I have an requirement that retrieving the data from two different data bases. I want to compare those two and prepare a report using VBA. I am able to get the data to excel separately, but now I need to join these two sets based on the key columns
View 2 Replies
View Related
Feb 26, 2007
Column A2:A100 contains part description various len lengths max is 50 min is 22.
Column B2:B100 contains scrap qtys.
In column C2:C100 in need to join the text in A and B.
i want the scrap qty's all to be alligned i.e level, as column C is shown in a userformlist box.
meaning joining text/values would look like this (ignore full stops)
dispenser calsberg .........70
tap beer......................... 80
cowl................................100
instead of
dispenser calsberg 70
tap beer 80
cowl 100
View 9 Replies
View Related
Apr 20, 2009
I want to take a cell with a persons first name and a cell with their last name and combine into one.
EX.
What I have.
A1 B1
John Smith
Walt Smith
What I want.
A1
John Smith
Walt Smith
View 9 Replies
View Related
Jun 14, 2009
I have a long OR function that I'm working on. The logicals for this change the search value from 1 to 9. Here is one of the logicals:
sumproduct(--isnumber(search(1,???)))=0
I need the "???" to be the arrays. The most complex of these will be: A1:C1&a2&c2&a3:c3 or is it
A1:c1,a2,c2,a3:c3 or perhaps another join method like
concatinate(a1:a3,a2,c2,a3:c3)
How do you join arrays to get the right result?
View 9 Replies
View Related