Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
carl
 
Posts: n/a
Default Modifying A Formula

I would like to use this formula "=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation like this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.



  #2   Report Post  
Mangesh Yadav
 
Posts: n/a
Default

Its a User Defined Function. You need to provide the code for it. The UF in
the name of the function says that its a user function. Press Alt F11 to
view the code. Check the standard modules on the left and see where the code
is and post it.

Mangesh



"carl" wrote in message
...
I would like to use this formula "=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation like this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.





  #3   Report Post  
Bob Phillips
 
Posts: n/a
Default

I can see that ConcatUF is a UDF of yours, which you don't show, but I don't
get what the formula currently does or what you want.

Can you try re-posting with the start data (use a character as a cell
delimiter like ||) and expected results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
I would like to use this formula "=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation like this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.





  #4   Report Post  
carl
 
Posts: n/a
Default

Hi Bob. Thank you trying to help me.

The function concatenates a selected range. I tried to show the expected
results in the last table of my post:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

For example in B2, I need a formula to look at the value in $A2 and $B1,
find all values in the data table that map up to these 2 cells, and
concatenate them with a ";" as the separator.

Sorry I can't explain this any better.

Thank you again.



"Bob Phillips" wrote:

I can see that ConcatUF is a UDF of yours, which you don't show, but I don't
get what the formula currently does or what you want.

Can you try re-posting with the start data (use a character as a cell
delimiter like ||) and expected results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
I would like to use this formula "=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation like this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.






  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default

Carl,

Sorry to keep pushing mate, but that data looks scrambled to me. I cannot
tell whether Row 1 is a label in a cell, signifies a row or what, And is the
10:30:00 in B, C.? Is AM U4 Q1 all in one cell. If you could relay before
and after I can give it a shot, but at present I am not clear what is
required.

Another thing, is this to work on a set of rows, or just one? If the former,
can you give an example with more than one row of results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Hi Bob. Thank you trying to help me.

The function concatenates a selected range. I tried to show the expected
results in the last table of my post:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

For example in B2, I need a formula to look at the value in $A2 and $B1,
find all values in the data table that map up to these 2 cells, and
concatenate them with a ";" as the separator.

Sorry I can't explain this any better.

Thank you again.



"Bob Phillips" wrote:

I can see that ConcatUF is a UDF of yours, which you don't show, but I

don't
get what the formula currently does or what you want.

Can you try re-posting with the start data (use a character as a cell
delimiter like ||) and expected results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
I would like to use this formula

"=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation like this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.










  #6   Report Post  
carl
 
Posts: n/a
Default

Thanks again Bob. The fomating of this post makes it tough to explain.
Perhaps I could send you an example spreadsheet. If so, just let me know
where to send it.

"Bob Phillips" wrote:

Carl,

Sorry to keep pushing mate, but that data looks scrambled to me. I cannot
tell whether Row 1 is a label in a cell, signifies a row or what, And is the
10:30:00 in B, C.? Is AM U4 Q1 all in one cell. If you could relay before
and after I can give it a shot, but at present I am not clear what is
required.

Another thing, is this to work on a set of rows, or just one? If the former,
can you give an example with more than one row of results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Hi Bob. Thank you trying to help me.

The function concatenates a selected range. I tried to show the expected
results in the last table of my post:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

For example in B2, I need a formula to look at the value in $A2 and $B1,
find all values in the data table that map up to these 2 cells, and
concatenate them with a ";" as the separator.

Sorry I can't explain this any better.

Thank you again.



"Bob Phillips" wrote:

I can see that ConcatUF is a UDF of yours, which you don't show, but I

don't
get what the formula currently does or what you want.

Can you try re-posting with the start data (use a character as a cell
delimiter like ||) and expected results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
I would like to use this formula

"=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation like this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.









  #7   Report Post  
Bob Phillips
 
Posts: n/a
Default

You could post an example at http://www.savefile.com/filehost/ and let me
know your URL. But show expected results as well.

--
HTH

Bob Phillips

"carl" wrote in message
...
Thanks again Bob. The fomating of this post makes it tough to explain.
Perhaps I could send you an example spreadsheet. If so, just let me know
where to send it.

"Bob Phillips" wrote:

Carl,

Sorry to keep pushing mate, but that data looks scrambled to me. I

cannot
tell whether Row 1 is a label in a cell, signifies a row or what, And is

the
10:30:00 in B, C.? Is AM U4 Q1 all in one cell. If you could relay

before
and after I can give it a shot, but at present I am not clear what is
required.

Another thing, is this to work on a set of rows, or just one? If the

former,
can you give an example with more than one row of results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Hi Bob. Thank you trying to help me.

The function concatenates a selected range. I tried to show the

expected
results in the last table of my post:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

For example in B2, I need a formula to look at the value in $A2 and

$B1,
find all values in the data table that map up to these 2 cells, and
concatenate them with a ";" as the separator.

Sorry I can't explain this any better.

Thank you again.



"Bob Phillips" wrote:

I can see that ConcatUF is a UDF of yours, which you don't show, but

I
don't
get what the formula currently does or what you want.

Can you try re-posting with the start data (use a character as a

cell
delimiter like ||) and expected results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
I would like to use this formula

"=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation like

this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.











  #8   Report Post  
carl
 
Posts: n/a
Default

THanks again. Was not sure how to use the link below. I sent you an example
directly. Appreciate your help.

"Bob Phillips" wrote:

You could post an example at http://www.savefile.com/filehost/ and let me
know your URL. But show expected results as well.

--
HTH

Bob Phillips

"carl" wrote in message
...
Thanks again Bob. The fomating of this post makes it tough to explain.
Perhaps I could send you an example spreadsheet. If so, just let me know
where to send it.

"Bob Phillips" wrote:

Carl,

Sorry to keep pushing mate, but that data looks scrambled to me. I

cannot
tell whether Row 1 is a label in a cell, signifies a row or what, And is

the
10:30:00 in B, C.? Is AM U4 Q1 all in one cell. If you could relay

before
and after I can give it a shot, but at present I am not clear what is
required.

Another thing, is this to work on a set of rows, or just one? If the

former,
can you give an example with more than one row of results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Hi Bob. Thank you trying to help me.

The function concatenates a selected range. I tried to show the

expected
results in the last table of my post:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

For example in B2, I need a formula to look at the value in $A2 and

$B1,
find all values in the data table that map up to these 2 cells, and
concatenate them with a ";" as the separator.

Sorry I can't explain this any better.

Thank you again.



"Bob Phillips" wrote:

I can see that ConcatUF is a UDF of yours, which you don't show, but

I
don't
get what the formula currently does or what you want.

Can you try re-posting with the start data (use a character as a

cell
delimiter like ||) and expected results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
I would like to use this formula
"=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation like

this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.












  #9   Report Post  
Bob Phillips
 
Posts: n/a
Default

Carl,


a little different that the layout that you asked for, but it does work. It
will look like

09:30:05 || A || E1;Y0;U4;S2;AG;Q0;B5
09:30:05 || B || S7;C2:A5
09:30:15 || B || MA;G7;A6;N4
09:30:15 || A || K0;B7;CK;SC;AK;AJ

Add the UDF below to a standard code module.

Then in the worksheet where you want the formula, select an array of cells
that will be at least as many columns and rows as you want, hit F2, and in
the formula bar, enter your formula, such as
=MultiConcat(C5:C256,";")
which is an array formula, so commit with Ctrl-Shift-Enter.

BTW I found the original UDF, a gem from Bernie Dietrick. I removed the
unique and filtered options as well.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
THanks again. Was not sure how to use the link below. I sent you an

example
directly. Appreciate your help.

"Bob Phillips" wrote:

You could post an example at http://www.savefile.com/filehost/ and let

me
know your URL. But show expected results as well.

--
HTH

Bob Phillips

"carl" wrote in message
...
Thanks again Bob. The fomating of this post makes it tough to explain.
Perhaps I could send you an example spreadsheet. If so, just let me

know
where to send it.

"Bob Phillips" wrote:

Carl,

Sorry to keep pushing mate, but that data looks scrambled to me. I

cannot
tell whether Row 1 is a label in a cell, signifies a row or what,

And is
the
10:30:00 in B, C.? Is AM U4 Q1 all in one cell. If you could relay

before
and after I can give it a shot, but at present I am not clear what

is
required.

Another thing, is this to work on a set of rows, or just one? If the


former,
can you give an example with more than one row of results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Hi Bob. Thank you trying to help me.

The function concatenates a selected range. I tried to show the

expected
results in the last table of my post:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

For example in B2, I need a formula to look at the value in $A2

and
$B1,
find all values in the data table that map up to these 2 cells,

and
concatenate them with a ";" as the separator.

Sorry I can't explain this any better.

Thank you again.



"Bob Phillips" wrote:

I can see that ConcatUF is a UDF of yours, which you don't show,

but
I
don't
get what the formula currently does or what you want.

Can you try re-posting with the start data (use a character as a

cell
delimiter like ||) and expected results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
I would like to use this formula
"=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation like

this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.














  #10   Report Post  
carl
 
Posts: n/a
Default

Thanks. Looking for the UDF in your reply ? Regards.

"Bob Phillips" wrote:

Carl,


a little different that the layout that you asked for, but it does work. It
will look like

09:30:05 || A || E1;Y0;U4;S2;AG;Q0;B5
09:30:05 || B || S7;C2:A5
09:30:15 || B || MA;G7;A6;N4
09:30:15 || A || K0;B7;CK;SC;AK;AJ

Add the UDF below to a standard code module.

Then in the worksheet where you want the formula, select an array of cells
that will be at least as many columns and rows as you want, hit F2, and in
the formula bar, enter your formula, such as
=MultiConcat(C5:C256,";")
which is an array formula, so commit with Ctrl-Shift-Enter.

BTW I found the original UDF, a gem from Bernie Dietrick. I removed the
unique and filtered options as well.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
THanks again. Was not sure how to use the link below. I sent you an

example
directly. Appreciate your help.

"Bob Phillips" wrote:

You could post an example at http://www.savefile.com/filehost/ and let

me
know your URL. But show expected results as well.

--
HTH

Bob Phillips

"carl" wrote in message
...
Thanks again Bob. The fomating of this post makes it tough to explain.
Perhaps I could send you an example spreadsheet. If so, just let me

know
where to send it.

"Bob Phillips" wrote:

Carl,

Sorry to keep pushing mate, but that data looks scrambled to me. I
cannot
tell whether Row 1 is a label in a cell, signifies a row or what,

And is
the
10:30:00 in B, C.? Is AM U4 Q1 all in one cell. If you could relay
before
and after I can give it a shot, but at present I am not clear what

is
required.

Another thing, is this to work on a set of rows, or just one? If the


former,
can you give an example with more than one row of results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Hi Bob. Thank you trying to help me.

The function concatenates a selected range. I tried to show the
expected
results in the last table of my post:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

For example in B2, I need a formula to look at the value in $A2

and
$B1,
find all values in the data table that map up to these 2 cells,

and
concatenate them with a ";" as the separator.

Sorry I can't explain this any better.

Thank you again.



"Bob Phillips" wrote:

I can see that ConcatUF is a UDF of yours, which you don't show,

but
I
don't
get what the formula currently does or what you want.

Can you try re-posting with the start data (use a character as a
cell
delimiter like ||) and expected results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
I would like to use this formula
"=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation like
this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.

















  #11   Report Post  
Bob Phillips
 
Posts: n/a
Default

What a prat :-). And worst of all, I deleted it so I have had to re-do it
.... sigh!

Here it is

Option Explicit

Function MultiConcat(rng As Range, _
Optional separator As String = ",")
Dim cell As Range
Dim cSize As Long
Dim fByRows As Boolean
Dim fNotFirst As Boolean
Dim aryData
Dim vKey1, vkey2
Dim i As Long, j As Long
Dim stemp

'validate input
If rng.Rows.Count 1 And rng.Columns.Count 1 Then
MultiConcat = "Select a single column or row array"
Exit Function
ElseIf rng.Rows.Count = 1 And rng.Columns.Count = 1 Then
MultiConcat = "Oly one cell selected"
ElseIf rng.Rows.Count 1 Then
fByRows = True
cSize = rng.Rows.Count
Else
cSize = rng.Columns.Count
End If

'initialise all the checking data
vKey1 = rng(1, 1).Offset(0, -1).Value
vkey2 = rng(1, 1).Offset(0, 1).Value
'allow an extra 2 for the check values
ReDim aryData(1 To cSize, 1 To cSize + 2)
aryData(1, 1) = vKey1
aryData(1, 2) = vkey2
i = 1: j = 3
stemp = ""
For Each cell In rng
If cell.Value < "" Then
If cell.Offset(0, -1) = vKey1 And cell.Offset(0, 1).Value =
vkey2 Then
If fNotFirst Then
stemp = stemp & separator & cell.Value
Else
stemp = cell.Value
fNotFirst = True
End If
Else
aryData(i, j) = stemp
stemp = ""
'clear down the rest of this dimension of the array
If j < UBound(aryData, 2) Then
For j = j + 1 To UBound(aryData, 2)
aryData(i, j) = ""
Next j
End If
stemp = cell.Value
aryData(i, 1) = vKey1
aryData(i, 2) = vkey2
vKey1 = cell.Offset(0, -1).Value
vkey2 = cell.Offset(0, 1).Value
i = i + 1
j = 3
End If
End If
Next cell

'pick up o/s data
aryData(i, 1) = vKey1
aryData(i, 2) = vkey2
aryData(i, j) = stemp
'clear down the rest of this dimension of the array
If j < UBound(aryData, 2) Then
For j = j + 1 To UBound(aryData, 2)
aryData(i, j) = ""
Next j
End If

'clear down the rest of the array
If i < UBound(aryData, 1) Then
For i = i + 1 To UBound(aryData, 1)
For j = 1 To UBound(aryData, 2)
aryData(i, j) = ""
Next j
Next i
End If

MultiConcat = aryData
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Thanks. Looking for the UDF in your reply ? Regards.

"Bob Phillips" wrote:

Carl,


a little different that the layout that you asked for, but it does work.

It
will look like

09:30:05 || A || E1;Y0;U4;S2;AG;Q0;B5
09:30:05 || B || S7;C2:A5
09:30:15 || B || MA;G7;A6;N4
09:30:15 || A || K0;B7;CK;SC;AK;AJ

Add the UDF below to a standard code module.

Then in the worksheet where you want the formula, select an array of

cells
that will be at least as many columns and rows as you want, hit F2, and

in
the formula bar, enter your formula, such as
=MultiConcat(C5:C256,";")
which is an array formula, so commit with Ctrl-Shift-Enter.

BTW I found the original UDF, a gem from Bernie Dietrick. I removed the
unique and filtered options as well.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
THanks again. Was not sure how to use the link below. I sent you an

example
directly. Appreciate your help.

"Bob Phillips" wrote:

You could post an example at http://www.savefile.com/filehost/ and

let
me
know your URL. But show expected results as well.

--
HTH

Bob Phillips

"carl" wrote in message
...
Thanks again Bob. The fomating of this post makes it tough to

explain.
Perhaps I could send you an example spreadsheet. If so, just let

me
know
where to send it.

"Bob Phillips" wrote:

Carl,

Sorry to keep pushing mate, but that data looks scrambled to me.

I
cannot
tell whether Row 1 is a label in a cell, signifies a row or

what,
And is
the
10:30:00 in B, C.? Is AM U4 Q1 all in one cell. If you could

relay
before
and after I can give it a shot, but at present I am not clear

what
is
required.

Another thing, is this to work on a set of rows, or just one? If

the

former,
can you give an example with more than one row of results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Hi Bob. Thank you trying to help me.

The function concatenates a selected range. I tried to show

the
expected
results in the last table of my post:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

For example in B2, I need a formula to look at the value in

$A2
and
$B1,
find all values in the data table that map up to these 2

cells,
and
concatenate them with a ";" as the separator.

Sorry I can't explain this any better.

Thank you again.



"Bob Phillips" wrote:

I can see that ConcatUF is a UDF of yours, which you don't

show,
but
I
don't
get what the formula currently does or what you want.

Can you try re-posting with the start data (use a character

as a
cell
delimiter like ||) and expected results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
I would like to use this formula
"=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation

like
this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.

















  #12   Report Post  
carl
 
Posts: n/a
Default

Hi Bob. Is there a limit on the length of the cell range I am trying to
concatenate.

I found that if I enter this:

=multiconcat(C4:C75,";")

all goes well. However if I increase to:

=multiconcat(C4:C76,";")

The formula returns #VALUE!.

Am I entering the formula incorrectly ?

Thanks Again.

"Bob Phillips" wrote:

What a prat :-). And worst of all, I deleted it so I have had to re-do it
.... sigh!

Here it is

Option Explicit

Function MultiConcat(rng As Range, _
Optional separator As String = ",")
Dim cell As Range
Dim cSize As Long
Dim fByRows As Boolean
Dim fNotFirst As Boolean
Dim aryData
Dim vKey1, vkey2
Dim i As Long, j As Long
Dim stemp

'validate input
If rng.Rows.Count 1 And rng.Columns.Count 1 Then
MultiConcat = "Select a single column or row array"
Exit Function
ElseIf rng.Rows.Count = 1 And rng.Columns.Count = 1 Then
MultiConcat = "Oly one cell selected"
ElseIf rng.Rows.Count 1 Then
fByRows = True
cSize = rng.Rows.Count
Else
cSize = rng.Columns.Count
End If

'initialise all the checking data
vKey1 = rng(1, 1).Offset(0, -1).Value
vkey2 = rng(1, 1).Offset(0, 1).Value
'allow an extra 2 for the check values
ReDim aryData(1 To cSize, 1 To cSize + 2)
aryData(1, 1) = vKey1
aryData(1, 2) = vkey2
i = 1: j = 3
stemp = ""
For Each cell In rng
If cell.Value < "" Then
If cell.Offset(0, -1) = vKey1 And cell.Offset(0, 1).Value =
vkey2 Then
If fNotFirst Then
stemp = stemp & separator & cell.Value
Else
stemp = cell.Value
fNotFirst = True
End If
Else
aryData(i, j) = stemp
stemp = ""
'clear down the rest of this dimension of the array
If j < UBound(aryData, 2) Then
For j = j + 1 To UBound(aryData, 2)
aryData(i, j) = ""
Next j
End If
stemp = cell.Value
aryData(i, 1) = vKey1
aryData(i, 2) = vkey2
vKey1 = cell.Offset(0, -1).Value
vkey2 = cell.Offset(0, 1).Value
i = i + 1
j = 3
End If
End If
Next cell

'pick up o/s data
aryData(i, 1) = vKey1
aryData(i, 2) = vkey2
aryData(i, j) = stemp
'clear down the rest of this dimension of the array
If j < UBound(aryData, 2) Then
For j = j + 1 To UBound(aryData, 2)
aryData(i, j) = ""
Next j
End If

'clear down the rest of the array
If i < UBound(aryData, 1) Then
For i = i + 1 To UBound(aryData, 1)
For j = 1 To UBound(aryData, 2)
aryData(i, j) = ""
Next j
Next i
End If

MultiConcat = aryData
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Thanks. Looking for the UDF in your reply ? Regards.

"Bob Phillips" wrote:

Carl,


a little different that the layout that you asked for, but it does work.

It
will look like

09:30:05 || A || E1;Y0;U4;S2;AG;Q0;B5
09:30:05 || B || S7;C2:A5
09:30:15 || B || MA;G7;A6;N4
09:30:15 || A || K0;B7;CK;SC;AK;AJ

Add the UDF below to a standard code module.

Then in the worksheet where you want the formula, select an array of

cells
that will be at least as many columns and rows as you want, hit F2, and

in
the formula bar, enter your formula, such as
=MultiConcat(C5:C256,";")
which is an array formula, so commit with Ctrl-Shift-Enter.

BTW I found the original UDF, a gem from Bernie Dietrick. I removed the
unique and filtered options as well.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
THanks again. Was not sure how to use the link below. I sent you an
example
directly. Appreciate your help.

"Bob Phillips" wrote:

You could post an example at http://www.savefile.com/filehost/ and

let
me
know your URL. But show expected results as well.

--
HTH

Bob Phillips

"carl" wrote in message
...
Thanks again Bob. The fomating of this post makes it tough to

explain.
Perhaps I could send you an example spreadsheet. If so, just let

me
know
where to send it.

"Bob Phillips" wrote:

Carl,

Sorry to keep pushing mate, but that data looks scrambled to me.

I
cannot
tell whether Row 1 is a label in a cell, signifies a row or

what,
And is
the
10:30:00 in B, C.? Is AM U4 Q1 all in one cell. If you could

relay
before
and after I can give it a shot, but at present I am not clear

what
is
required.

Another thing, is this to work on a set of rows, or just one? If

the

former,
can you give an example with more than one row of results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Hi Bob. Thank you trying to help me.

The function concatenates a selected range. I tried to show

the
expected
results in the last table of my post:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

For example in B2, I need a formula to look at the value in

$A2
and
$B1,
find all values in the data table that map up to these 2

cells,
and
concatenate them with a ";" as the separator.

Sorry I can't explain this any better.

Thank you again.



"Bob Phillips" wrote:

I can see that ConcatUF is a UDF of yours, which you don't

show,
but
I
don't
get what the formula currently does or what you want.

Can you try re-posting with the start data (use a character

as a
cell
delimiter like ||) and expected results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
I would like to use this formula
"=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the concatenation

like
this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.


















  #13   Report Post  
Bob Phillips
 
Posts: n/a
Default

Hi Carl,

Yeah, it must be the size of the array that is the problem.

I have dimensioned the array both ways at maximum size, this is overkill and
a problem here. Try changing this line


ReDim aryData(1 To cSize, 1 To cSize + 2)

to

ReDim aryData(1 To cSize, 1 To 12)

or a number 2 greater that the maximum number of values in C for any date,
letter combination.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Hi Bob. Is there a limit on the length of the cell range I am trying to
concatenate.

I found that if I enter this:

=multiconcat(C4:C75,";")

all goes well. However if I increase to:

=multiconcat(C4:C76,";")

The formula returns #VALUE!.

Am I entering the formula incorrectly ?

Thanks Again.

"Bob Phillips" wrote:

What a prat :-). And worst of all, I deleted it so I have had to re-do

it
.... sigh!

Here it is

Option Explicit

Function MultiConcat(rng As Range, _
Optional separator As String = ",")
Dim cell As Range
Dim cSize As Long
Dim fByRows As Boolean
Dim fNotFirst As Boolean
Dim aryData
Dim vKey1, vkey2
Dim i As Long, j As Long
Dim stemp

'validate input
If rng.Rows.Count 1 And rng.Columns.Count 1 Then
MultiConcat = "Select a single column or row array"
Exit Function
ElseIf rng.Rows.Count = 1 And rng.Columns.Count = 1 Then
MultiConcat = "Oly one cell selected"
ElseIf rng.Rows.Count 1 Then
fByRows = True
cSize = rng.Rows.Count
Else
cSize = rng.Columns.Count
End If

'initialise all the checking data
vKey1 = rng(1, 1).Offset(0, -1).Value
vkey2 = rng(1, 1).Offset(0, 1).Value
'allow an extra 2 for the check values
ReDim aryData(1 To cSize, 1 To cSize + 2)
aryData(1, 1) = vKey1
aryData(1, 2) = vkey2
i = 1: j = 3
stemp = ""
For Each cell In rng
If cell.Value < "" Then
If cell.Offset(0, -1) = vKey1 And cell.Offset(0, 1).Value =
vkey2 Then
If fNotFirst Then
stemp = stemp & separator & cell.Value
Else
stemp = cell.Value
fNotFirst = True
End If
Else
aryData(i, j) = stemp
stemp = ""
'clear down the rest of this dimension of the array
If j < UBound(aryData, 2) Then
For j = j + 1 To UBound(aryData, 2)
aryData(i, j) = ""
Next j
End If
stemp = cell.Value
aryData(i, 1) = vKey1
aryData(i, 2) = vkey2
vKey1 = cell.Offset(0, -1).Value
vkey2 = cell.Offset(0, 1).Value
i = i + 1
j = 3
End If
End If
Next cell

'pick up o/s data
aryData(i, 1) = vKey1
aryData(i, 2) = vkey2
aryData(i, j) = stemp
'clear down the rest of this dimension of the array
If j < UBound(aryData, 2) Then
For j = j + 1 To UBound(aryData, 2)
aryData(i, j) = ""
Next j
End If

'clear down the rest of the array
If i < UBound(aryData, 1) Then
For i = i + 1 To UBound(aryData, 1)
For j = 1 To UBound(aryData, 2)
aryData(i, j) = ""
Next j
Next i
End If

MultiConcat = aryData
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Thanks. Looking for the UDF in your reply ? Regards.

"Bob Phillips" wrote:

Carl,


a little different that the layout that you asked for, but it does

work.
It
will look like

09:30:05 || A || E1;Y0;U4;S2;AG;Q0;B5
09:30:05 || B || S7;C2:A5
09:30:15 || B || MA;G7;A6;N4
09:30:15 || A || K0;B7;CK;SC;AK;AJ

Add the UDF below to a standard code module.

Then in the worksheet where you want the formula, select an array of

cells
that will be at least as many columns and rows as you want, hit F2,

and
in
the formula bar, enter your formula, such as
=MultiConcat(C5:C256,";")
which is an array formula, so commit with Ctrl-Shift-Enter.

BTW I found the original UDF, a gem from Bernie Dietrick. I removed

the
unique and filtered options as well.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
THanks again. Was not sure how to use the link below. I sent you

an
example
directly. Appreciate your help.

"Bob Phillips" wrote:

You could post an example at http://www.savefile.com/filehost/

and
let
me
know your URL. But show expected results as well.

--
HTH

Bob Phillips

"carl" wrote in message
...
Thanks again Bob. The fomating of this post makes it tough to

explain.
Perhaps I could send you an example spreadsheet. If so, just

let
me
know
where to send it.

"Bob Phillips" wrote:

Carl,

Sorry to keep pushing mate, but that data looks scrambled to

me.
I
cannot
tell whether Row 1 is a label in a cell, signifies a row or

what,
And is
the
10:30:00 in B, C.? Is AM U4 Q1 all in one cell. If you could

relay
before
and after I can give it a shot, but at present I am not

clear
what
is
required.

Another thing, is this to work on a set of rows, or just

one? If
the

former,
can you give an example with more than one row of results?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"carl" wrote in message
...
Hi Bob. Thank you trying to help me.

The function concatenates a selected range. I tried to

show
the
expected
results in the last table of my post:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

For example in B2, I need a formula to look at the value

in
$A2
and
$B1,
find all values in the data table that map up to these 2

cells,
and
concatenate them with a ";" as the separator.

Sorry I can't explain this any better.

Thank you again.



"Bob Phillips" wrote:

I can see that ConcatUF is a UDF of yours, which you

don't
show,
but
I
don't
get what the formula currently does or what you want.

Can you try re-posting with the start data (use a

character
as a
cell
delimiter like ||) and expected results?

--

HTH

RP
(remove nothere from the email address if mailing

direct)


"carl" wrote in message

...
I would like to use this formula
"=ConcatUF(times!B7:B16,";",FALSE,FALSE)"
in the table below.

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM
Row3 9:30:00 AM


My data table is setup like this:

ColA ColB ColC
Row1 Time A B
Row2 9:30:00 AM E1 GG
Row3 9:30:00 AM Y0 D1
Row4 10:30:00 AM U4 Q1

Can the formula be modified to perform the

concatenation
like
this:

ColA ColB ColC
Row1 Time A B
Row2 10:30:00 AM U4 Q1
Row3 9:30:00 AM E1;Y0 D1;Q1

Thank you in advance.




















Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop Insert Row modifying formula data dazman Excel Discussion (Misc queries) 7 August 17th 05 10:22 AM
dragging a formula P Bates Excel Discussion (Misc queries) 3 August 7th 05 09:37 PM
Creating a check mark box MarthaSue Setting up and Configuration of Excel 18 April 28th 05 12:31 AM
Named SUM Formula with relative refernce(s) Werner Rohrmoser Excel Worksheet Functions 2 April 20th 05 04:56 PM
Match / Vlookup within an Array formula Hari Prasadh Excel Discussion (Misc queries) 3 February 3rd 05 04:37 PM


All times are GMT +1. The time now is 08:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"