formula needed

kylefoley76

Well-known Member
Joined
Mar 1, 2010
Messages
1,553
Screenshot2013-09-22at55948PM.png


I need a formula that can produce column D. Essentially, column B equals column A. So using column C I should be able to produce D.
 
Another way:
Code:
Array formula - use Ctrl+Shift+Enter and not only Enter to enter the formula

=INDEX($A$1:$A$6,MATCH(99^99,SEARCH("|"&MID(C1,1,FIND(",",C1)-1)&"|","|"&$B$1:$B$6&"|")))&","&
INDEX($A$1:$A$6,MATCH(99^99,SEARCH("|"&MID(C1,FIND(",",C1)+1,99)&"|","|"&$B$1:$B$6&"|")))

Or

Use only Enter to enter the formula

=LOOKUP(99^99,SEARCH("|"&MID(C1,1,FIND(",",C1)-1)&"|","|"&$B$1:$B$6&"|"),$A$1:$A$6)&","&
LOOKUP(99^99,SEARCH("|"&MID(C1,FIND(",",C1)+1,99)&"|","|"&$B$1:$B$6&"|"),$A$1:$A$6)

Markmzz
 
Last edited:
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
A more generic approach, using ACONCAT, a workalike of Longre's MCONCAT...

Add the following code in <acronym title="visual basic for applications">VBA</acronym> to your workbook using Alt+F11...

Function aconcat(a As Variant, Optional sep As String = "") As String
' Harlan Grove, Mar 2002
Dim y As Variant
If TypeOf a Is Range Then
For Each y In a.Cells
aconcat = aconcat & y.Value & sep
Next y
ElseIf IsArray(a) Then
For Each y In a
aconcat = aconcat & y & sep
Next y
Else
aconcat = aconcat & a & sep
End If
aconcat = Left(aconcat, Len(aconcat) - Len(sep))
End Function

Now invoke...

D1, control+shift+enter and copy down:
Rich (BB code):
=REPLACE(aconcat(IF(ISNUMBER(SEARCH(","&$B$1:$B$3,","&$C1)),
   ","&$A$1:$A$3,"")),1,1,"")

I couldn't get this formula to work.
 
Upvote 0
Another way:
Code:
Array formula - use Ctrl+Shift+Enter and not only Enter to enter the formula

=INDEX($A$1:$A$6,MATCH(99^99,SEARCH("|"&MID(C1,1,FIND(",",C1)-1)&"|","|"&$B$1:$B$6&"|")))&","&
INDEX($A$1:$A$6,MATCH(99^99,SEARCH("|"&MID(C1,FIND(",",C1)+1,99)&"|","|"&$B$1:$B$6&"|")))

Or

Use only Enter to enter the formula

=LOOKUP(99^99,SEARCH("|"&MID(C1,1,FIND(",",C1)-1)&"|","|"&$B$1:$B$6&"|"),$A$1:$A$6)&","&
LOOKUP(99^99,SEARCH("|"&MID(C1,FIND(",",C1)+1,99)&"|","|"&$B$1:$B$6&"|"),$A$1:$A$6)

Markmzz

This formula only works with 2 numbers in column c. Sometimes I might have up to 5 or 6 numbers in column c.
 
Upvote 0
no, I couldn't get it to run.

the error message i'm getting is #name

I think it's ACONCAT. You need to add the VBA code for this function first to your workbook as a module using Alt+F11. When done so, the REPLACE formula will not give #NAME? error. It will just work as intended.
 
Upvote 0
I think it's ACONCAT. You need to add the VBA code for this function first to your workbook as a module using Alt+F11. When done so, the REPLACE formula will not give #NAME? error. It will just work as intended.


Only VBA Cod e Would be the fine for this


Regards
Prince
 
Upvote 0

Forum statistics

Threads
1,215,494
Messages
6,125,137
Members
449,207
Latest member
VictorSiwiide

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top