UDF To Concatenate Column Range Conditional Upon Another Column
Jul 11, 2012
Writing a UDF for VBA as I'm getting frustrated by the concatenate function.
I basically want to create my own function that will concatenate values in column B, if the value in column A is correct.
I've been looking at this link [URL] ......
With a very simple data set as an example, I want the following output in column C:
pet
food
conc
cat
chicken
chicken,fish,catnip
[Code] ........
I think I need to create a cell based function which takes a conditional range (col A) and concatenate range (col B) as inputs, stores this as a 5 by 3 array and then returns the concatenated output I wish (by referencing the stored array) based on what value is in column A. A "concatenate if", if you like.
View 4 Replies
ADVERTISEMENT
Mar 12, 2014
My issue is that I have 1200+ addresses to make more readable - the first column is the street name, the second is the post code(s) relative to the street - what Ideally I'd like to achieve is one row per street, the street name followed by the post codes... i.e. take this...
A33 Relief RoadRG2 0RR
Abbey SquareRG1 3AG
Abbey SquareRG1 3BE
Abbey SquareRG1 3BQ
Abbey SquareRG1 3FB
Abbey StreetRG1 3AN
Abbey StreetRG1 3BA
Abbey StreetRG1 3BD
Abbots WalkRG1 3HW
Aberford CloseRG30 2NX
Admirals CourtRG1 6SP
Admirals CourtRG1 6SR
Admirals CourtRG1 6SS
Admirals CourtRG1 6SW
Ainsdale CrescentRG30 3NG
Alan PlaceRG30 3BW
Albany RoadRG30 2UL
to this...
A33 Relief RoadRG2 0RR
Abbey SquareRG1 3AG, RG1 3BE, RG1 3BQRG1 3FB
Abbey StreetRG1 3AN, RG1 3BA, RG1 3BD
Abbots WalkRG1 3HW
Aberford CloseRG30 2NX
Admirals CourtRG1 6SP, RG1 6SR, RG1 6SS, RG1 6SW
Ainsdale CrescentRG30 3NG
Alan PlaceRG30 3BW
Albany RoadRG30 2UL
View 5 Replies
View Related
Sep 27, 2007
I had a problem finding something then deleting the column, I tried to alter the code from that thread to solve a new problem and I am close (I think), but not quite there. I need to find the column "Group" and merge it with the column "Sex" which is offset by 1 column. This code will go through and find the column "Group" and merge for the first cell, but will then get stuck in a loop just concatenating "Sex" to the end continuously. I need it to concatenate both columns entirely together. Any simple fix to what I modified? Previous thread should you be interested:Find Part Text On All Sheets & Delete The Column.
View 9 Replies
View Related
Oct 18, 2008
when the largest number in column B the hotel in column A should be in bold.
So in excel language IF(Number in B Is Max display corresponding hotel in column A as BOLD. But I can't figure out how to do this.
You can see here on the image:
additionalimage.gif
View 4 Replies
View Related
Feb 2, 2010
i trying to merge column A1 (ABC) with column B1(XYZ), B2(LOL), B3(ROF) ..etc
with a simple =CONCATENATE(A1,"-",B1) , i can get "ABC-XYZ" , but when come to column B2 , i only can get "-LOL" , any solution ?
View 4 Replies
View Related
Sep 27, 2006
I have created vbscript that references a particular column and row. This cell is referred to many times in the scripting but the row may change from time to time. I would like to know how I can define the row value at the top and reference this row within my vbscript.
Dim row As Integer
row = 1
'vb script coding referring to cell
ws.Range("B&row").Copy Destination:= Sheets("Summary").Range("B1")
ws.Range("E&row").Copy Destination:=Sheets("Summary").Range("B16")
ws.Range("F&row").Copy Destination:=Sheets("Summary").Range("B17")
I tried to concatenate the row to the column but it doesn't seem to work. When I would like to change the row value I would like to only make the change where row is defined rather than within each line of coding.
View 9 Replies
View Related
May 24, 2007
how to concatenate whole column to a single cell in Excel. I have 3605 cells to be concatenated to a single cell
View 5 Replies
View Related
Jul 30, 2009
I would like a macro that does this
1. Find the "Customer Number" column by name
2. Find the range of the "Customer Number" column (bottom-most cell with data)
3. Find the column named "Date Shipped"
4. If there are any NON-Blank cells in the column named "Date Shipped", put the word "Sent" in the "Status" column (also needs to be found by name). This macro should stop when it is equal to the bottom-most cell in the "Customer Number" column.
View 9 Replies
View Related
May 2, 2014
I need a macro to be prepared to Concatenate serial and case separated by a "-"to find the Number column as shown in attachment ...
E.g. If serial is 27943900. After Concatenating it should be 27943900-001004
Example.xlsx‎
View 7 Replies
View Related
Apr 27, 2006
Can I concatenate two different rows in a column?
View 10 Replies
View Related
Aug 8, 2008
I am trying to concatenate multiple lines of comments into one string and place that string in the comment field corresponding to the start of each record set. I believe the code below is close, but I am receiving this error
Run-time error '91':
Object variable or with block variable not set
Debug points to this line
rngComment = . Cells(intCounter, 5)
I'm not sure what I am doing wrong.
Option Explicit.........................
View 7 Replies
View Related
Mar 24, 2014
I am trying to get a complete list of applications per device. I have the device list but it is broken down into seperate lines so i would like some sort of formula (not fussed what type as long as it gets the desired results!) that will look in column A and if the text is the same, to concatenate the info in column b, separated by a comma. So for the first device (4d713006) i would get 1 cell that would have the list of all 52 applications in it separated by a formula. This is so i can vlookup the device name from another sheet and pull through all the list of applications.
I have attached the data : example.xlsx‎
View 3 Replies
View Related
Feb 4, 2014
we want to add/concatenate the values of first column and show the result in next column. The problem is fully explained in the comment section of the sheet attached. But still if you are having in getting the problem
View 6 Replies
View Related
Aug 13, 2013
I need a formula to be placed in cell Col A, Row 1, that concatenates any and all cells in Col A, with a ';' separating each item. I only want this concatenation performed ONLY IF an adjacent cell in Col B contains the letter 'X.
Additionally, if the cell in Col A is null, then I the formula to ignore it, and not perform the concatenation.
Is there a way to do this formulaically?
View 1 Replies
View Related
Jun 26, 2014
In my assignment, I need to concatenate data from certain row and column ( The concatenate data will about 200 character). So once the concatenate cell change, it will copy the value to the next column.
View 9 Replies
View Related
Jun 6, 2007
I need to cocatenate anything between and including column 4 and col (unkown until macro is run)
is there a way to do this?
Basically need to add all the cells from 4th column to whatever col is. Example if col = 12
then I need columns 4 to 11 all rows together
View 9 Replies
View Related
May 30, 2014
In Column A, anytime a specific "text" appears, I want to concatenate the information in the row, and place it into worksheet Data-list under a specific heading.
[URL]
The formula I would use (not vba) is =IF(A3="FN",B3,""), then I just copy it all the way down. However there are 27K cells, which is why I want a VBA Code
View 8 Replies
View Related
Apr 11, 2013
Pivot Table. I have a large data set and have used a pivot table to summarise the COUNT of each row (Objects) for each Column Name (that is, I did what Pivot Tables do).
What I'd like to do in a new column is show a string of all the column names per row name.
I have a data set that looks like this:
Sheet3
A
B
C
1
Object
Description
Class
[Code]...
So I can pivot table to work with other analysis, but what I'd really like to get is a list of unique "Objects" (easy) with all the related "Class"es listed in column (or straight to concatenated). I can concatenate using Chip Pearson's StringConcat.
Here is an example:
Sheet3
F
G
H
I
J
K
1
Object
Countif
[Code]..
You can see Chip's Function in col K. What I'd like to happen is in Cols H to J be automatically populated. (For this example, I have typed in what I'd like the result to look like)
I considered using Vlookups (with helper column for 2nd & successive instances), INDEX/MATCH with SMALL to get 2nd+ instances and even lengthy IF statements. The main problem with IF is that in the real data set, I can have over 30 Classes.
I looked at Pivot table to see what I could do but haven't much experience in manipulating past regular feature.
I also took a cut&paste of the pivot table (as shown in part below) to see what I could do.
Here is a clip straight from the Pivot Table:
Pivot
A
B
C
D
E
F
G
H
I
J
[Code]..
And one from the cut&paste of the pivot table, which also shows the desired outcome in the right hand column:
Sheet2
A
B
C
D
E
F
G
[Code]...
I would also be fine using VBA, but its been a while since I did any basic coding so I wouldn't really stand a chance of starting from scratch.
View 4 Replies
View Related
May 9, 2013
What can I add to this existing formula to look for duplicate values in the entire column (D) and then concatenate the text of column (K) in each of those rows together?
Essentially I want to string all text in column K together, for each duplicate row of column D with the results in column L.
=IF(D14=D15,CONCATENATE(K14,K15),K14)
View 1 Replies
View Related
Aug 16, 2013
I am attempting to concatenate the dept numbers for each user in a list. For example, the first user listed below is associated with 6 depts. I would like the resulting macro to concatenate the dept's into one cell next to the Name.
Below is an example with the solution I am attempting to produce.
Sample Table
Name
Dept
Abbruzzese,James L
188100
[Code] ......
Output
Name
Dept
Abbruzzese,James L
188100, 231100, 600377, 600656, 600663, 600708
Abdi,Salahadin
600607, 600670, 600878, 600879, 710432, 710432, 710435
View 2 Replies
View Related
Apr 4, 2014
I have a 2 groups of column headings with a different month and year in each heading so
1st Group of columns range
Columns AJ through AX
Column Heading example "Expense Ratio February 2013......next Column over is "Expense Ratio March 2013"
2nd Group of columns range AY though CE
Column Heading example "Capital Balance February 2013......next Column over is "Capital Balance March 2013"
Each new month I need to add a new Expense Ratio column after the most recent expense ratio Column. (i.e. Find "Expense Ratio March 2013" and I need to add a column after that with heading "Expense Ratio April 2013"
Same thing for Capital Balance - add a new Capital Balance column after the most recent Capital Balance Column. (i.e. Find "Capital Balance March 2013" and I need to add a column after that for "Expense Ratio April 2013"
Because the ranges keep changing month over month, how do i do this.
View 4 Replies
View Related
Jun 1, 2009
I'm trying to write a code that calculates 2nd column based on 3rd column's number or vice versa based on the condition set on the 1st column. Below, there are two procedures. "SimpleCalc" and "SimpleCalc2". I first wrote SimpleCalc2, but it isn't working, so I worked around the error by writing SimpleCalc, which selects a cell and moves around by offset. I personally find it hard to read and error prone as I develop more logic around it.
I'm trying to develop more function based on this code, so I need to make it neat and flexible. what I'm doing wrong in SimpleCalc2? Or do you have any suggestion to improve the code "SimpleCalc"? I'm using Excel 2003.
Sub SimpleCalc()
Dim SimpleMethodRng, SimpleMethod As String, i As Integer
ActiveWorkbook.Worksheets("Dashboard").Range("P5").Select
SimpleMethodRng = ActiveWorkbook.Worksheets("Dashboard").Range("N5:P12")
For i = 1 To 8
SimpleMethod = SimpleMethodRng(i, 1).........
View 3 Replies
View Related
Dec 17, 2009
I want to do, is search column A for claim numbers that match. When I do have a matching claim number, I want to concatenate the original cells ownership field with the said matching cells ownership field (or move into a column in the same row, I can always concatenate later). Once that is complete, I want to delete the row I took the information out of.
I want to join this data in ArcGIS, but as of right now, it's not a 1-to-1 relationship, so only a relate works. That doesn't help me as I want to display claims by ownership, and this can vary per claim. Company A may have 100% on one claim, and then split another claim 50% with Company B.
This causes a double entry on the claim field in this current spreadsheet I have, which requires me to clean it up by making multiple columns of ownership vs. an additional row for shared ownership.
My problem:
Column A Column B
1235555 Company A (50%)
1235555 Company B (50%)
1235556 Company A (100%)
1235557 Company A (33%)
1235557 Company B (33%)
1235557 Company C (33%)
What I would like to see
Column A Column B Column C Column D
1235555 Company A (50%) Company B (50%)
1235556 Company A (100%)
1235557 Company A (33%) Company B (33%) Company C (33%)
View 3 Replies
View Related
Jun 22, 2008
I have two sets of two columns which contain numbers as text with trailing spaces and I want to concatenate column A and B and concatenate column F and G, and then compare them, and sumif value in column I if they are the same - giving the answer in the same row as the matching data in column A and B.. but in column J.
I’ve seen sum product and haven’t been able to get it to work at all. I have been adding the trim() function in around the column references to see if that would work but am failing…
A = 2000 text
B = 1234 text
F = 2000 trailing spaces, text
G = 1234 trailing spaces, text
I = 10,000
Answer in column J
I want 20001234 = 20001234 = 10,000 for the whole column.
I don't want to change the original data as its externally sourced and used for other links etc.. This would save a few hours a week if i ( more correctly, you ) could get this to work.
View 9 Replies
View Related
Feb 19, 2009
I'm creating a macro that creates a co-ocurrence matrix from variables that are adjacent to each other.
In order to proceed, I need to know how to return the column number of the first (leftmost) column in a range that the user selects.
View 2 Replies
View Related
Dec 8, 2005
Col C = Text and Col F = dates
I would like to count the # of times a value occurs in Col C based on a date
range in Col F.
View 11 Replies
View Related
Oct 28, 2009
I have a formula that counts if a date range is present. However I need to change it to count another column only if that date range is present. For example a17 a50000 the user will enter the date of the order. and in column B has the order number. I want the formula to count the order numbers for a data range in column A.
Here is what I have but it is counting the dates in col A not the order numbers in B?
View 3 Replies
View Related
Jan 22, 2014
I am trying to Count (or counta?) cells in one column if they have data but only if within a date range in another column.
So, in the example below, I would want to count how many cells in column E have data in them, but only if the date in column A falls between Jan 1 2014 and Jan 5 2014. (In this case, result should be 4).
A
B
C
D
E
01/01/2014
[Code].....
View 4 Replies
View Related
Mar 7, 2008
I have two different Excel reports and the data needs to be copied from each column on one spreadsheet and pasted to the bottom of the equivalent column on the other spreadsheet.
So, is it possible to get a macro that will copy the data from one column then paste it to the next free cell in the column on the other spreadsheet.
If I could get some code to do one column then this should be enough to get me started and I could apply this to the other columns I need to copy.
View 8 Replies
View Related
Jul 25, 2011
I need to concatenate varying numbers of cells based on duplicates found in a separate column, but I'm not sure how to approach it. I have 41,000+ rows of data, so I have to find a formula.
Example:
1AB2Denton, PaulFB357D4D3OwensTest, MarcyFB539F934Brennan,
JosephFB539F935Bowser, AmyFB539F936LaRock, ChuckFB667D3B
Based on duplicates in column B, I want to combine the data in column A into one cell. The duplicates in column B could be only 2, or could be 20+.
View 2 Replies
View Related