formula help

lirkus84

New Member
Joined
Mar 18, 2016
Messages
8
Hello I need some help with creating a formula for the below table. What I am trying to achieve is in the "required results" column A. The "Name" entries will always have "Name" preceding
[TABLE="width: 500"]
<tbody>[TR]
[TD]required results
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Name Jimmy
[/TD]
[/TR]
[TR]
[TD]Name Jimmy -shoes
[/TD]
[TD]-shoes
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Name Tom
[/TD]
[/TR]
[TR]
[TD]Name Tom-Balls
[/TD]
[TD]-Balls
[/TD]
[/TR]
[TR]
[TD]Name Tom-nets
[/TD]
[TD]-nets
[/TD]
[/TR]
[TR]
[TD]Name Tom-snacks
[/TD]
[TD]-snacks
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Let's say that your data is in the range B1:B6.
Then enter this formula in cell A2 and copy down for all rows:
Code:
=IF(LEFT(B2,4)="Name","",IF(LEFT(B1,4)="Name",B1 & B2,LEFT(A1,LEN(A1)-LEN(B1)) & B2))
 
Upvote 0
Same general idea as Joe4:

BCDE
ListHelperRequired Results
Name Jimmy-shoes
Name Jimmy-shoesName Tom-Balls
Name Tom-nets
Name Tom-BallsName Tom-snacks
Name Tom-netsName Mary-socks
Name Tom-snacksName Mary-shin guards
Name Alice-chalk
-socksName Mary-socks
Name Mary-shin guards
-chalkName Alice-chalk

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: center"]2[/TD]
[TD="bgcolor: #FAFAFA"]Name Jimmy[/TD]

[TD="align: right"][/TD]

[TD="align: center"]3[/TD]
[TD="bgcolor: #FAFAFA"]-shoes[/TD]

[TD="align: right"][/TD]

[TD="align: center"]4[/TD]
[TD="bgcolor: #FAFAFA"]Name Tom[/TD]

[TD="align: right"][/TD]

[TD="align: center"]5[/TD]
[TD="bgcolor: #FAFAFA"]-Balls[/TD]

[TD="align: right"][/TD]

[TD="align: center"]6[/TD]
[TD="bgcolor: #FAFAFA"]-nets[/TD]

[TD="align: right"][/TD]

[TD="align: center"]7[/TD]
[TD="bgcolor: #FAFAFA"]-snacks[/TD]

[TD="align: right"][/TD]

[TD="align: center"]8[/TD]
[TD="bgcolor: #FAFAFA"]Name Mary[/TD]

[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"][/TD]

[TD="align: center"]10[/TD]
[TD="bgcolor: #FAFAFA"]-shin guards[/TD]

[TD="align: right"][/TD]

[TD="align: center"]11[/TD]
[TD="bgcolor: #FAFAFA"]Name Alice[/TD]

[TD="align: right"][/TD]

[TD="align: center"]12[/TD]

[TD="align: right"][/TD]

[TD="align: center"]13[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet8

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]C2[/TH]
[TD="align: left"]=IF(LEFT(B2,4)="Name","",LOOKUP(2,1/ISERROR(FIND("-",$B$1:$B1)),$B$1:$B1)&B2)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]D2[/TH]
[TD="align: left"]{=IFERROR(INDEX($C$2:$C$20,SMALL(IF($C$2:$C$20<>"",ROW($C$2:$C$20)-ROW($C$2)+1),ROWS($D$2:$D2))),"")}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]



I added an array formula in D to remove the spaces if you want.
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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