Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Parent/Child Macro

I am looking to get some big time help on writing a macro or formula
to fill out the parent id based on the child id. I have filled out
some of the parent id's to show how it should look. Basically the
parent id follows a general wbs structure where .01.01 would be the
parent of .01.01.01. Any help would be fantastic.
thanks

Child id Parent id
V/0047.FNG.01.01
V/0047.FNG.01.01.01 V/0047.FNG.01.01
V/0047.FNG.01.02 V/0047.FNG.01
V/0047.FNG.01.02.01 V/0047.FNG.01.02
V/0047.FNG.01.03 V/0047.FNG.01
V/0047.FNG.01.03.01 V/0047.FNG.01.03
V/0047.FNG.01.03.02 V/0047.FNG.01.03
V/0047.FNG.01.03.03 V/0047.FNG.01.03
V/0047.FNG.01.03.04 V/0047.FNG.01.03
V/0047.FNG.01.03.05 V/0047.FNG.01.03
V/0047.FNG.01.03.06 V/0047.FNG.01.03
V/0047.FNG.01.04
V/0047.FNG.01.04.01
V/0047.FNG.01.04.02
V/0047.FNG.01.04.03
V/0047.FNG.01.04.04
V/0047.FNG.01.05

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Parent/Child Macro

Is the Parent *ALWAYS* the same as the Child except that the last ".nn" is
missisng?

Function ParentCode(ChildCode As String) As String
If Len(ChildCode) <= 16 Then
ParentCode = vbNullString
Else
ParentCode = Left(ChildCode, Len(ChildCode) - 3)
End If
End Function

or if length of the code doesn't matter, use just

Function ParentCode(ChildCode As String) As String
ParentCode = Left(ChildCode, Len(ChildCode) - 3)
End Function


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"turtle" wrote in message
ups.com...
I am looking to get some big time help on writing a macro or formula
to fill out the parent id based on the child id. I have filled out
some of the parent id's to show how it should look. Basically the
parent id follows a general wbs structure where .01.01 would be the
parent of .01.01.01. Any help would be fantastic.
thanks

Child id Parent id
V/0047.FNG.01.01
V/0047.FNG.01.01.01 V/0047.FNG.01.01
V/0047.FNG.01.02 V/0047.FNG.01
V/0047.FNG.01.02.01 V/0047.FNG.01.02
V/0047.FNG.01.03 V/0047.FNG.01
V/0047.FNG.01.03.01 V/0047.FNG.01.03
V/0047.FNG.01.03.02 V/0047.FNG.01.03
V/0047.FNG.01.03.03 V/0047.FNG.01.03
V/0047.FNG.01.03.04 V/0047.FNG.01.03
V/0047.FNG.01.03.05 V/0047.FNG.01.03
V/0047.FNG.01.03.06 V/0047.FNG.01.03
V/0047.FNG.01.04
V/0047.FNG.01.04.01
V/0047.FNG.01.04.02
V/0047.FNG.01.04.03
V/0047.FNG.01.04.04
V/0047.FNG.01.05


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
parent/child relationship between rows? Doug Excel Worksheet Functions 4 April 22nd 23 07:41 PM
Creating child worksheet from parent Vibeke Excel Worksheet Functions 7 July 9th 09 04:34 AM
Parent/Child Field turtle[_2_] Excel Programming 1 September 4th 07 04:18 PM
parent/child ranges Susan Excel Programming 3 May 4th 07 05:00 PM
Sorting Parent Child kcmtnbiker Excel Worksheet Functions 2 March 31st 06 01:54 AM


All times are GMT +1. The time now is 07:51 AM.

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

About Us

"It's about Microsoft Excel"