Return Column Name.

pizpower

New Member
Joined
May 15, 2024
Messages
10
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hello,

I'd like to to automate few things, where I need to match the Main/Red ID's and get the Cab which will be in the 1st cell of each column, is this possible?

Settings Sheet Example:
Main ID'sRed ID'sCab 1Cab 2
1246​
1248​
1244​
761​
1242​
1244​
1242​
762​
558​
580​
600​
761​
762​
1328​
1329​
1140​
1141​
1236​
1238​

Sheet 2 Example:
Patch Details APatch Details BCabinet ID ACabinet ID B
ID1242 F67-68ID761 F1-2
ID1244 F59-60ID762 F1-2

In sheet 2 I'd like to return 2 results in a single cell, example:

Patch Details APatch Details BCabinet ID ACabinet ID B
ID1242 F67-68ID761 F1-2
Main,Cab 1​
Main,Cab 2​

or seperate

Patch Details APatch Details BCabinet ID AID ACabinet ID BID B
ID1242 F67-68ID761 F1-2
Cab 1​
Main
Cab 2​
Main

Thanks in advanced.
David
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
so far for the part of the main/red i managed to make it work like this but i believe this can be improved, not an expert in excel :(
=IFNA(IFS(SUMPRODUCT(IFERROR(SEARCH(FILTER('ODF Location Settings'!$A$2:$A$5000,'ODF Location Settings'!$A$2:$A$5000<>""),F2),""))>0,"Main ID",SUMPRODUCT(IFERROR(SEARCH(FILTER('ODF Location Settings'!$B$2:$B$5000,'ODF Location Settings'!$B$2:$B$5000<>""),F2),""))>0,"Red ID"),"Not Assigned")
 
Upvote 0
Book1
ABCDEFGHIJ
1Table1
2Main ID'sRed ID'sCab 1Cab 2Patch Details APatch Details BCabinet ID ACabinet ID B
3124612481244761ID1242 F67-68ID761 F1-2Main, Cab 1Main, Cab 2
4124212441242762ID1244 F59-60ID762 F1-2Red, Cab 1Red, Cab 2
5558580600ID580 xyzID777 xyzRed 
6761762ID1236 abcID600 abcMainCab 2
713281329
811401141
912361238
10
Sheet1
Cell Formulas
RangeFormula
H3:H6H3=SUBSTITUTE(LET(t, TEXTBEFORE([@[Patch Details A]]," "), id, --RIGHT(t,LEN(t)-2), TEXTJOIN(", ", 1, IF(MMULT(SEQUENCE(1,ROWS(Table1),1,0), --(Table1=id)), Table1[#Headers], ""))), " ID's", "")
I3:I6I3=SUBSTITUTE(LET(t, TEXTBEFORE([@[Patch Details B]]," "), id, --RIGHT(t,LEN(t)-2), TEXTJOIN(", ", 1, IF(MMULT(SEQUENCE(1,ROWS(Table1),1,0), --(Table1=id)), Table1[#Headers], ""))), " ID's", "")
 
Upvote 1
Solution
Book3
ABCDEFGHI
1Table1
2Main ID'sRed ID'sCab 1Cab 2Patch Details APatch Details BCabinet ID ACabinet ID B
3124612481244761ID1242 F67-68ID761 F1-2Main , Cab 1Cab 2, Main
4124212441242762ID1244 F59-60ID762 F1-2Cab 1, Red Cab 2, Red
5558580600ID580 xyzID777 xyzRed  
6761762ID1236 abcID600 abcMain Cab 2
713281329
811401141
912361238
Sheet5
Cell Formulas
RangeFormula
H3:I6H3=TEXTJOIN(", ",,IF(--TEXTAFTER(TEXTBEFORE(F3," "),"ID")=--$A$3:$D$9,TEXTBEFORE($A$2:$D$2,"ID",,,,$A$2:$D$2),""))
 
Upvote 1
Aaa thanks:) will try it later looks exactly what I need.

Thanks both for your help.
 
Upvote 0
Book3
ABCDEFGHI
1Table1
2Main ID'sRed ID'sCab 1Cab 2Patch Details APatch Details BCabinet ID ACabinet ID B
3124612481244761ID1242 F67-68ID761 F1-2Main , Cab 1Cab 2, Main
4124212441242762ID1244 F59-60ID762 F1-2Cab 1, Red Cab 2, Red
5558580600ID580 xyzID777 xyzRed  
6761762ID1236 abcID600 abcMain Cab 2
713281329
811401141
912361238
Sheet5
Cell Formulas
RangeFormula
H3:I6H3=TEXTJOIN(", ",,IF(--TEXTAFTER(TEXTBEFORE(F3," "),"ID")=--$A$3:$D$9,TEXTBEFORE($A$2:$D$2,"ID",,,,$A$2:$D$2),""))

my only issue with this is that for some reason am having some results swapped.

1716828346867.png

Also what i noticed the word ID, is not being added, for me it doesn't affect me, just trying to figure out the formula :D
Other then that it works fine.
 
Upvote 0
I removed the "ID" because you didn't show them in the OP. Try this.
Book1
ABCDEFGHI
1Table1
2Main ID'sRed ID'sCab 1Cab 2Patch Details APatch Details BCabinet ID ACabinet ID B
3124612481244761ID1242 F67-68ID761 F1-2Main ID's, Cab 1Main ID's, Cab 2
4124212441242762ID1244 F59-60ID762 F1-2Red ID's, Cab 1Red ID's, Cab 2
5558580600ID580 xyzID777 xyzRed ID's 
6761762ID1236 abcID600 abcMain ID'sCab 2
713281329
811401141
912361238
Sheet3
Cell Formulas
RangeFormula
H3:I6H3=TEXTJOIN(", ",,TOROW(IF(--TEXTAFTER(TEXTBEFORE(F3," "),"ID")=--$A$3:$D$9,$A$2:$D$2,""),,1))
 
Upvote 0
Book1
ABCDEFGHIJ
1Table1
2Main ID'sRed ID'sCab 1Cab 2Patch Details APatch Details BCabinet ID ACabinet ID B
3124612481244761ID1242 F67-68ID761 F1-2Main, Cab 1Main, Cab 2
4124212441242762ID1244 F59-60ID762 F1-2Red, Cab 1Red, Cab 2
5558580600ID580 xyzID777 xyzRed 
6761762ID1236 abcID600 abcMainCab 2
713281329
811401141
912361238
10
Sheet1
Cell Formulas
RangeFormula
H3:H6H3=SUBSTITUTE(LET(t, TEXTBEFORE([@[Patch Details A]]," "), id, --RIGHT(t,LEN(t)-2), TEXTJOIN(", ", 1, IF(MMULT(SEQUENCE(1,ROWS(Table1),1,0), --(Table1=id)), Table1[#Headers], ""))), " ID's", "")
I3:I6I3=SUBSTITUTE(LET(t, TEXTBEFORE([@[Patch Details B]]," "), id, --RIGHT(t,LEN(t)-2), TEXTJOIN(", ", 1, IF(MMULT(SEQUENCE(1,ROWS(Table1),1,0), --(Table1=id)), Table1[#Headers], ""))), " ID's", "")
This works perfect! Thanks :D
 
Upvote 0

Forum statistics

Threads
1,216,759
Messages
6,132,556
Members
449,735
Latest member
Gary_M

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