Results 1 to 2 of 2

Thread: Macro to return data column header for column A in column B

  1. #1

    Macro to return data column header for column A in column B



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi,

    I was wondering if someone could help me write a macro that returns the following values in column B please?

    I have data in column A in which rows are seperated by blanks between blocks of data and the blocks or varying length.
    I would like to return a portion of the string say 11 characters in column B and replicate this result for the number of cells in B that are non blank in A. See example below.

    Your help would be greatly appreciated, many thanks.

    Setanta

    PeopleList1Names1 PeopleList1
    John PeopleList1
    Joe PeopleList1
    Jack PeopleList1
    PeopleList2Names2 PeopleList2
    Kate PeopleList2
    Jess PeopleList2
    Katie PeopleList2
    Samantha PeopleList2
    PeopleList3Names3 PeopleList3
    Alan PeopleList3
    Glynn PeopleList3
    Tom PeopleList3

  2. #2
    Super Moderator JeffreyWeir's Avatar
    Join Date
    Mar 2011
    Location
    New Zealand
    Posts
    357
    Articles
    0
    If your data is exactly as described, and if it starts in A2, then you can put this in C2:
    =IF(LEFT(A2,10)="PeopleList",LEFT(A2,11),IF(NOT(ISBLANK(A2)),C2,""))

    If your data is different, then click the Go Advanced button below, and upload a sample workbook.
    Last edited by JeffreyWeir; 2013-07-21 at 08:26 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •