+ Reply to Thread
Results 1 to 31 of 31

Separating Data

  1. #1
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Separating Data

    Hi Guys,
    I hope you will be able to help me with this problem.
    I get output from servers which I am trying to get useful data from to put into a database.
    I want to take out the server name and the applications that run onto it but there are many Servers so doing it manually is exteremly time consuming and a lot of the output is information which I want to ignore.
    There are also applications that I want to ignore such as software patches so if there was a way to specify which ones to ignore that would be great.
    Also, some servers do not have any applications on them so this would also have to be taken into account.
    I have uploaded an example (using dummy data)
    On the second sheet I have uploaded how I would like the output (if possible) so I can run the macro on it to normalise it before entering it into the database.


    Thanks in advance!

    *Sorry for spelling separating wrong in the title!
    Attached Files Attached Files
    Last edited by coletteno1; 09-17-2010 at 05:57 AM. Reason: Spelling mistake in title

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Separating Data

    Is it always the case that the server name starts with \\ and that those characters aren't elsewhere in the data? Also, does the list of applications always run from the title "Applications:" to the start of the next server name? Do you have any servers with no applications?

  3. #3
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    -Yes the Server Name always starts with \\ and as far as I can see is the only use for them (not mentioned anywhere else apart from the beginning of the server name.)
    -Yes the list always runs from the title 'Applications:'
    -Yes there are some servers with no applications

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Separating Data

    Try this:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    Thanks!
    It works for my example but when I try it on the real data it only copies the server name.
    Would this be because the Applications in the example are called 'Application 1' etc whereas on the real data they are called like McAfee etc?
    Thanks for the help so far
    Colette

  6. #6
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    sorry if I wasn't clear about that

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Separating Data

    Colette - yes, that will be the reason. There isn't much point in uploading an example which doesn't reflect reality. So, what will the names actually be or how might we tell Excel to look for them? Will there still be an "Applications:" line?

  8. #8
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    Sorry about that.
    Yes there is still an 'Applications:' Line but the name of the applications that follow will be different application names like 'McAffe', 'Notepad' 'Apache Tomcat' etc

  9. #9
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Separating Data

    Try changing the line

    Please Login or Register  to view this content.

    To:

    Please Login or Register  to view this content.

  10. #10
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Separating Data

    Andrew-R: good teamwork!

  11. #11
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    Hello,
    Thanks for the fast response, when I change the line it throws an error:
    "Runtime error '1004' Application-defined or object-defined error'
    But when I check the output it seems to have worked as far as I can tell. :D


    This is great, is there a way of telling the script to ignore certain applications?
    For example there are many security updates that I want to ignore and not have in the output table.
    Thanks
    Colettte

  12. #12
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Separating Data

    Quote Originally Posted by StephenR View Post
    Andrew-R: good teamwork!
    Sorry for hijacking your code. Mine was a bit more complex, so you pipped me to the post, so I was desperate for some of the glory

  13. #13
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Separating Data

    Not at all. Well done for deciphering my code! Btw no reason why you shouldn't post your solution too.

    Colette - you could add an If statement inside the Do-While loop, e.g. if <>"Fred" then...

  14. #14
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    or could I create a list of applications to ignore and then include this in the script?
    Thanks guys you have been a great help so far!

  15. #15
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    also how could I remove the semi colon after each of the server names in the output?

  16. #16
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Separating Data

    This will be sufficient:

    Please Login or Register  to view this content.



  17. #17
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    Quote Originally Posted by snb View Post
    This will be sufficient:

    Please Login or Register  to view this content.

    Hi snb, could you explain this code to me? Sorry I'm a complete newb to VB.
    Colette

  18. #18
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Separating Data

    It gives the result you asked for (if sheets(2) is empty)
    It takes 2 pages to explain.
    Please test it first in your application.

    But I think (combined with the other question you had) that it is better to explain what you want eventually. My impression is that you are asking about steps between in a larger process. Those steps may turn out to be unnecessary.
    The 'flatter' the data, the easier to manipulate. What you asked for in this post is adding a structure to the data. That makes the data more complex and may complicate the handling later on.
    Last edited by snb; 09-17-2010 at 09:59 AM.

  19. #19
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Separating Data

    Quote Originally Posted by snb View Post
    It gives the result you asked for (if sheets(2) is empty)
    It takes 2 pages to explain.
    Please test it first in your application.
    Quote Originally Posted by snb View Post
    Avoid using VBA-code you do not understand.
    Warning! Juxtaposition error!


  20. #20
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Separating Data

    @Andrew,

    So you used the code twice....(and sheets(2) wasn't empty)

    with application.displayalerts=False it will run smoothly.
    or
    Please Login or Register  to view this content.
    Last edited by snb; 09-17-2010 at 10:04 AM.

  21. #21
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Separating Data

    I can assure you that for values of application = IRL my displayalerts has always been on False.

  22. #22
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    Thanks snb,
    I get a 'type 13 runtime error- type mismatch' :S

  23. #23
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Separating Data

    Did you copy my code ?
    Did you alter the code ?
    Are you using data different from the data in the sample you put here ?

  24. #24
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    Yes I am using different data, yes I copied your code and no I didn't alter it? I tried it on the sample code and it didn’t work either.


    I'm really happy with the code that StephenR and Andrew-R produced, I was just looking for a way to be able to ignore certain applications from the output and I don't know enough VBA to alter the code to do this so any help would be greatly appreciated!
    Colette

  25. #25
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Separating Data

    That is very neat code snb, but it leaves off FISH for some reason when I ran it. It would help if you added sheets references everywhere too I think.

    Modify loop...
    Please Login or Register  to view this content.

  26. #26
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Separating Data

    There's an strange error caused by application.transpose.
    It can be circumvented by

    Please Login or Register  to view this content.
    The error is caused due to writing more than 255 characters in a cell.
    Last edited by snb; 09-19-2010 at 11:33 AM.

  27. #27
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    any ideas guys?
    Want to extend the code to ignore specified values such as 'security update'.... how would I do this?
    Colette

  28. #28
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Separating Data

    I improved my code in the last post. Did you test it ?

  29. #29
    Registered User
    Join Date
    09-16-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Separating Data

    Hi snb, it worked on the example but when I tried it on a larger data set I got this error:
    Run time 13 error- Type mismatch.
    Is this because of the same issue i had earlier in the thread as in the example applications are called 'Application 1' etc whereas in the spreadsheet i'm implementing it on has values such as 'McAfee' and 'Apache Tomcat'?
    Also where in this formula could I specify which applications to ignore?

  30. #30
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Separating Data

    if you want to exclude 'McAfee'

    Please Login or Register  to view this content.
    If you do not provide some real data, we can't track down the error.
    The only explanation appearing in my crystal ball is that not a single cell contains the string "System information for \\"
    Last edited by snb; 09-20-2010 at 07:05 AM.

  31. #31
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Separating Data

    How about a method that only uses formulae?

    1/. Begin your data in A2 and add this line to the end of your raw data.
    Please Login or Register  to view this content.

    2/. Drag the formula in Columns C&D down to this added line.
    In C2
    Please Login or Register  to view this content.

    In D2
    Please Login or Register  to view this content.

    3/. Filter C:D on Column D for non-blanks, at this stage any unwanted applications can also be filtered out.

    4/. Copy the result and paste special > values to F:G

    5/. Filter F:G on Column F for non-blanks

    6/. Copy the result in Column G to Column I

    7/. Remove the filter

    8/. The result is now in Sheet2

    With Sheet2
    In A4
    Please Login or Register  to view this content.
    Drag/Fill down until "END" appears.

    In B4
    Please Login or Register  to view this content.
    Drag/Fill down and across to suit.

    Once this sheet is established it becomes a "live" template for any list you choose to import and filter.

    Hope this helps, or at least offers a different view of your problem.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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