+ Reply to Thread
Results 1 to 75 of 75

Creating a new column

  1. #1
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Creating a new column

    Hi,

    Just wondering if anyone could help me with this. In the attached I have data regarding drug development projects. In column C I have Event types and in B I have the dates at which each event took place. As you can see in each cell I have several events and dates separated by a line break. Each line in, let's say, cell B2 corresponds exactly with the line in the same position in cel C2. The same applies to all cell in columns B and C. I need to create an extra column (D) called "First Launches" that take the value in B that is in the same line as the term "first launches" in column C. The new column in the attach is in blue, I have done this one manually as an example. The values in B and C that are used to create the new column are in red. I have more than 3000 rows like this. Is there any easy way of doing this?
    THanks
    AntonioDrug sample.xlsx

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Creating a new column

    Put this formula in D2 and fill down.

    It should do most of the work for you.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Hi Mehmetcick,

    Thanks for that. I tried but got a #Value! error message. Just wondering if there is anything I am missing? Thanks a lot
    Regards
    Antonio

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Creating a new column

    D2=IFERROR(TRIM(MID(SUBSTITUTE(B2,CHAR(10),REPT(" ",LEN(B2))),(LEN(LEFT(C2,SEARCH("First Launches",C2)))-LEN(SUBSTITUTE(LEFT(C2,SEARCH("First Launches",C2)),CHAR(10),"")))*LEN(B2)+1,LEN(B2))),"")
    Try this and copy towards down
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks Siva,

    I tried your formula but what I get is all the dates that are in column B and not just the one corresponding to first launches. I guess this is close enough though?
    Thanks
    Antonio

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Creating a new column

    or
    =IFERROR(MID(B2,SEARCH("^???????????^^",SUBSTITUTE(SUBSTITUTE(CHAR(10)&B2&CHAR(10),CHAR(10),"^",1+LEN(LEFT(C2,SEARCH("First Launches",C2)))-LEN(SUBSTITUTE(LEFT(C2,SEARCH("First Launches",C2)),CHAR(10),""))),CHAR(10),"^^",1+LEN(LEFT(C2,SEARCH("First Launches",C2)))-LEN(SUBSTITUTE(LEFT(C2,SEARCH("First Launches",C2)),CHAR(10),"")))),11),"")

  7. #7
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Creating a new column

    Where it is giving wrong result?
    can you attach sample file

  8. #8
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Hi Silva,

    I tried your last suggestion and I get no values. See attached.
    Thanks a lot
    Regards
    Antonio
    Attached Files Attached Files

  9. #9
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Creating a new column

    Quote Originally Posted by agarzon View Post
    Hi Silva,

    I tried your last suggestion and I get no values. See attached.
    Thanks a lot
    Regards
    Antonio

    It is working see attached file
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Hi,
    Sorry.
    Don't know what is wrong but when I open your file I just see blank values in the column. See screenshot.
    Cheers
    Attached Images Attached Images

  11. #11
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Creating a new column

    I don't get that
    Attached Files Attached Files

  12. #12
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Creating a new column

    Quote Originally Posted by agarzon View Post
    Hi,
    Sorry.
    Don't know what is wrong but when I open your file I just see blank values in the column. See screenshot.
    Cheers
    I don't, in Mac it works or not

  13. #13
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    I just tried in a PC and I can see it now. Weird!! Thanks a lot, very useful!!!

  14. #14
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Hi,

    Just one more question. What if I want to do the same thing for "Aditional Launches". In this case as you can see in the attached there can be more than one value. Using the formula as its now it would return the first value, but if I want the last value (see example in the third row)?
    Thanks
    Attached Files Attached Files

  15. #15
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,


    I've adapted Mehmetcik's formula (The Char(10)) to this VBA routine:

    Please Login or Register  to view this content.
    Directions for running the routine(s) just supplied

    If you haven't used macros before you'll need to go to:
    File- options - trust center -trust center settings - macro settings ,
    the second option down (disable all macros with notification)

    Then - Copy the code to the clipboard

    Open your Workbook

    Press ALT + F11 to open the Visual Basic Editor.

    Select "Module" from the Insert menu

    Type "Option Explicit" then paste the code under it

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name
    Last edited by xladept; 02-06-2015 at 07:32 PM.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  16. #16
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks a lot xladept,
    That works great for first launches.
    I adapted your routine to do something. This time I want to get the date for additional launches. In some entries there are more than one additional launches so if use your routine I get the first one, but what if I want the last one (the oldest), how would you change the below? Thanks a lot!

    Sub Agarzon(): Dim r As Long, i As Long, j As Long, k As Long, c As Long
    Dim X As String, Y As String, Z As String
    r = Range("B:B").Find("*", , , , xlByRows, xlPrevious).Row
    For i = 2 To r: X = Range("B" & i): Y = Range("C" & i)
    j = InStr(1, Y, "First Launches")
    If j = 0 Then GoTo GetNext
    For k = 1 To j
    If Mid(Y, k, 1) = Chr(10) Then
    c = c + 1: End If: Next k: j = Len(X)
    Z = Mid(X, c * 12 + 1, 12): Range("D" & i) = Z: c = 0
    GetNext: Next i: End Sub

  17. #17
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    Thanks for the rep!

    I changed the character count to 11 which, I think, is better. This seems to find the last Additional Launches:

    Please Login or Register  to view this content.
    * When you post code, you should encapsulate it with code tags, it's easy - just highlight the code and click on the #

  18. #18
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Hi xladept

    Thanks for that. I run your macros (see attached document). It seems that the macros as the are now they return the first value in B. What I would need for Agarzon macro is the date in B that is in the same position as First Launches in C. For macro AgarzonAL what I would need is the date in B that is in the same line of the oldest Additional Launches. I have added extra columns to each of the showing what values I would be looking for. Sorry if this is a bit too confusion. I would really appreciate your help with this.

    Thanks A lot
    Attached Files Attached Files

  19. #19
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Creating a new column

    see the attached file
    Attached Files Attached Files

  20. #20
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    I ran my programs and got exactly what you need

    Please Login or Register  to view this content.
    Last edited by xladept; 02-07-2015 at 03:34 PM.

  21. #21
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    I wrote this to get all of any type:

    Please Login or Register  to view this content.

  22. #22
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Hi Xladept,
    Thanks
    That is pretty cool. I tried by entering first launches and I got the attached. See screen shot. Do you get the same values as in the screen shot? Another solutions before was not displaying in my Mac but it did in a PC. I wonder this could be because I am using Mac, although that would be odd!!
    Thanks
    Attached Images Attached Images

  23. #23
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    I got the correct values with my PC - maybe Mac has a different newline character??

  24. #24
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Here's the routine for the Mac (Character 13 for a new line):

    Please Login or Register  to view this content.

  25. #25
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Creating a new column

    Quote Originally Posted by agarzon View Post
    Hi Xladept,
    Thanks
    That is pretty cool. I tried by entering first launches and I got the attached. See screen shot. Do you get the same values as in the screen shot? Another solutions before was not displaying in my Mac but it did in a PC. I wonder this could be because I am using Mac, although that would be odd!!
    Thanks

    Is post no 19 not working

  26. #26
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Screen Shot 2015-02-08 at 09.43.07.pngHI NFsales,

    This solution does not show values in a Mac .... I guess is the same problem as before. One of the very first solutions I got here didn't work in Mac but when I tried in a PC at work it worked. I will try on Monday on the PC at work. See below what I see from your doc., Thanks

  27. #27
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks a lot xladept! That works very well. Just one last thing. When I use for additional launches I get all the values for all the additional launches it can find. Is there a way that it would return only the oldest date?
    Thanks

  28. #28
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    The oldest date is returned by the second version, for the mac just change:

    Please Login or Register  to view this content.
    To

    Please Login or Register  to view this content.

  29. #29
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    HI!
    Thanks. Sorry all the back and forward. By doing what I still get all dates for additional launches. In the attached, for example, I would like to get only oldest date in this case 15 Mar 1990. I wonder if I am not getting it right cause it is a mac! :roll eyes:
    Thanks a lot
    Attached Images Attached Images

  30. #30
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    I meant that you should use this one:

    Please Login or Register  to view this content.

  31. #31
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Brilliant!!!! Thanks a million!
    Best Regards

  32. #32
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Best regards!

  33. #33
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Forum Example.xlsxHi again!

    How would you change the above macro if what I have in B are are sentences instead of dates (like the attached)?
    Thanks

  34. #34
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    If You're still looking for Additional Launches, you wouldn't need to change anyting unless you had omitted the Headers - in which case:
    Please Login or Register  to view this content.

  35. #35
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks Xladept,
    Sorry I didn't explain myself well. What if what I have in B instead of numeric values was string values? Basically I need the same macro do in the same thing but with string instead of numeric. It should return the string value in the same line as Additional Launches. Thanks a lot for your help!
    Regards

  36. #36
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    I'm a little confused - your sample doesn't have the B and C entries lining up f.r. there are 11 lines in C but only 8 in B???

  37. #37
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Sorry I didn't explain myself well there.
    I have attached a better example. Basically what I need is very similar to before. In this case I need what is in column D. So the idea is to get what is in the same line as "Discontinued Products" in column C. In the attached all the values for "Discontinued Products" happen to be in the first line but this might not always be the case. Also sometimes there might be more than one "Discontinued Product" in the cell, in this case, I would need to look at only the first line starting from the top (see last row for an example). Thanks a lot.Drug sample (xladept).xlsx
    Antonio

  38. #38
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    Try this, to run on mac change the red 10's to 13's and for other Criteria change the red string to the other Criterion

    Please Login or Register  to view this content.
    Last edited by xladept; 03-09-2015 at 07:03 PM.

  39. #39
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks a lot Xladept,

    I am applying the above to a larger dataset (around 8000 records like the ones I attached before). When I try to run the macro I get the following error: Run-time error '9'. Subscript out of range, and when I click debug I get the below (it seems the problem is in what I put in red). I know it works with the sample I sent you but I wonder why it doesn't in a larger data set? Thanks

    Option Explicit
    Sub AgarzonCrit(): Dim r As Long, h As Long, i As Long, j As Long, k As Long, c As Long
    Dim Criterion As String: Criterion = "Discontinued Products"
    Dim X, Y, Z As String: Range("AC:AC").ClearContents
    r = Range("R:R").Find("*", , , , xlByRows, xlPrevious).Row
    For i = 2 To r: X = Split(Range("R" & i), Chr(13)): Y = Split(Range("S" & i), Chr(13))
    Z = "": For j = LBound(X) To UBound(X)
    If (X(j)) = Criterion Then Z = Z & Y(j) & Chr(13)
    Next j: Range("AC" & i) = Z
    GetNext: Next i: End Sub

  40. #40
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Hi,
    I am attaching here the full document with the macro you suggested. In this one I get the out of range error. Drug sample (xladept)2.xlsThanks a lot!

  41. #41
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Double Post Deleted
    Last edited by xladept; 03-10-2015 at 04:22 PM.

  42. #42
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    There is no data in row 1884 column C - so that generates a subscript error. Try this:

    Please Login or Register  to view this content.
    And - Thanks for the rep!

  43. #43
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks a lot! It works beautifully!!
    You have been great help!
    Thanks!

  44. #44
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    You're welcome!

  45. #45
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Hi xladept,

    Thanks again for your help before. I have another issue and it would be great to get your help. I have the attached data and I need to extract first date available in column "marketing" to "marketingdate". Sometimes the first date you find in there it is just the year in this case I would be looking to add 1st of January before the year. Other times you can find the whole date and this case it should appear as it is. Any idea how to do this? I have given you a example outcome for each example. Thanks a lot!

    Antonio

    sample marketing date.xlsx

  46. #46
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    The entries in B aren't as the others - I'm thinking about it

  47. #47
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Hi Xladept,

    Thanks a lot! Not they are not. Unfortunately the dates are part of a text which I guess makes things more challenging. Thanks for your time!

  48. #48
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    There are some differences:

    Please Login or Register  to view this content.

  49. #49
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks a a lot again!!!!
    Best regards

  50. #50
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    You're welcome again!

  51. #51
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Hi Xladept again!
    Sorry for all the questions! But the data set I have it is quite messy. I hope you can help me with this one.
    In the attached I have a column called overview. In this column I am looking for the phrase: "Phase I". If the the overview cell contains the expression then I would like to get "Phase I " (note I am putting a space at the end to differentiate from Phase II in the search) in the new column Phaseoverview. I guess this is somehow similar to my previous queries. Thanks a lot!

    Phaseoverview.xlsx

  52. #52
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    Try this:

    Please Login or Register  to view this content.

  53. #53
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Brilliant!
    Thanks a lot!

  54. #54
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    You're welcome!

  55. #55
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Date Overview.xlsxHi Xladept,

    Just wondering if you could help me with a similar query. This time I want to extract the first date that we find in overview. Sometimes it is a complete date with day, month and year. But other times there is only month and year or only year. If there is only month and year then the first day of the month should be assigned and if there is only a year then it should add the the 1st of January. I guess this is similar to my previous requests. Thanks a lot

  56. #56
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    This catches the January 2000 rather than the November 2000 date?

    Please Login or Register  to view this content.

  57. #57
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Date Overview.xlsxHi Xladept,

    Thanks a lot for that. It works well in the sample I sent you, but when I try to use it my larger file I get i few discrepancies (see in the attached in red_. For example, for some of them it returns the wrong date (see first one in red) and for others it does not return anything at all?

    Thanks

  58. #58
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Date Overview(1).xlsx - This is what I got??

  59. #59
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Yes, that is right. The initial values in red in the document were copied from a larger document with more than 8000 rows. I put them in there for convenience. I wonder if there is any chance of the macro "going wrong" when applied to a larger document? What could go wrong? I tried to figure out but can't think of anything. Thanks

  60. #60
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    With the larger document there are more combinations and variations - it's always better to submit a significant sample

    I'm glad that it's still right - you'll let me know should things go awry, won't you??

  61. #61
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Sorry! I didn't explain myself well there. What I am saying is that the two last records in the last document I sent you were copied from my other larger document. Basically the macro does not seem to work after some point (either get a wrong value or no value) ... It is strange because with the other macros it worked for the entire 8000 rows ... ??

  62. #62
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Try to notice where it goes wrong, you can hover over the code - or does it just run to completion without any error?

    If you want to send me the complete file, I'm [email protected]

  63. #63
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks, just sent you an email
    regards

  64. #64
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    This runs pretty quickly if you don't need to format the output column(Commented out):

    Please Login or Register  to view this content.
    Last edited by xladept; 04-01-2015 at 02:59 PM.

  65. #65
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks,

    It seems to not work for the whole document, for example for row 951 I get 11/11/10 when it should be 7/07/06. After this point it doesn't seem to return anything at all? Thanks

  66. #66
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    There was a typo in the code - try this:

    Please Login or Register  to view this content.
    I'm sorry
    Last edited by xladept; 04-02-2015 at 03:00 PM.

  67. #67
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks a lot!
    No worries, really appreciate your help here.
    There still seems to be some problems. For example in row 8822 I get a date when I shouldn't be getting anything?
    Cheers

  68. #68
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    I've got nothing in AM8822

  69. #69
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    HI Xladept,

    It works now!!!! Perfectly!
    I wonder what happened before! Sure did something wrong!!

    Thanks again!!!! You have been great help!!

  70. #70
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    You're welcome! I'm glad that it's OK - I didn't know what else to do

  71. #71
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Hi again Xladept!
    I actually would need your help again. This time the task seems easier. I have a column with different values separated by a break (licensee column in the attached) and need to create n amount of columns called licensee1, licensee2 ... licensee(n). n would be determined by the maximum number of lines in licessee. Those columns would take the value of each of the lines in lincesee. How would you operationalise this? I gave you an example in the attached.

    Thanks a lot
    Regards
    Query Xladept 11.5.15.xlsx

  72. #72
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    Hi Agarzon,

    Try this - don't forget to change that 10 to 13 for the Mac!

    Please Login or Register  to view this content.

  73. #73
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks a lot!!
    Great!!

  74. #74
    Registered User
    Join Date
    02-05-2015
    Location
    Dublin
    MS-Off Ver
    Mac 2011
    Posts
    37

    Re: Creating a new column

    Thanks a lot!!
    Great!!

  75. #75
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a new column

    You're welcome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Creating Single Column List from multi-row/column table and removing blanks
    By ChemistB in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 03-10-2014, 02:23 PM
  2. Creating validation list from table column based on data in another column
    By dreamthrum in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-11-2013, 08:38 PM
  3. Replies: 3
    Last Post: 09-01-2013, 06:51 PM
  4. Creating 2 Column List Based on 1 Column of Data... with a catch. :)
    By samebito in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2013, 06:41 PM
  5. Help creating macro to find value of Column A within Column J, then align?
    By nickf829 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-12-2011, 12:40 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1