+ Reply to Thread
Results 1 to 20 of 20

help me to sort the data with v.b.a code

  1. #1
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Smile help me to sort the data with v.b.a code

    Hi all a very good morning to you all,

    I have an excel sheet where there is tons of data which is dispersed in uneven way. can some one please help me with the code to get the desired result.

    Please see the sample sheet attached.

    things needed from code:

    i want a new sheet with name as "Report analysis" to be created with headers in horizontal as ISIN, Cusip,Sedol,Div/Coupon rate
    i want macro should copy the ISIN, cusip,sedol ,Div/Coupon rate and paste it in new sheet
    the sheet format will be same as sample security reports sheet i provided
    ISIN will be in same row and it always be in 13 digits
    Cusip will be in 9 digits
    sedol will be in 7 digits
    after completing sheet 1 it should go to sheet 2 and leave 2 rows gap in report analysis sheet and again do the same process in sheet2 as sheet 1.
    please find the desired sheet as sample of what i want.
    thanks for your help in advance..... have a good day..........
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: help me to sort the data with v.b.a code

    can someone please look in to this..... thanks in advance for your help......

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: help me to sort the data with v.b.a code

    Hi, boddulus,

    according to the forum rules you should wait for a day before you push your own thread (and you didnīt consider that this a weekkend):

    If your question has not been answered within a day, consider adding another post with any additional information you believe is relevant. If you think your post is good as is, just reply to your own thread with the words "Bump no response", which will bring it to the top of the forum.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: help me to sort the data with v.b.a code

    Give some logic that what data is to be picked from unknown column like CUSIP can be found in col. A in any row but once a CUSIP is found in a row, how would you decide that which column has the desired CUSIP as your CUSIPs do not follow any pattern so how would it be different from other columns values?
    What is exactly in other columns? Is it the actual data or you have put some random characters in other columns?
    Code will need a logic to pick the correct data. It is just like visualizing the correct data manually and that even is based on some logic so that we know that this is the desired data to be picked and how it differs from other data in that row.
    Same way you need to give some logic to pick the data for ISIN, Sedol and div/coupon rate also.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: help me to sort the data with v.b.a code

    Hi Hahobe,

    i am sorry , i will follow the rules.......


    Hi Sktneer,

    i had given the logic's like headers will be always in column A and desired value will also be in same row other column.

    For example if first ISIN is in COLUMN A you will find the desired value of isin in same row

    coming on differentiating point ISIN is always 13 digits and if you observe no other data in same row is 13 digits.
    in same ways Cusip as 9 digits always in same row and if you observe no other data in same row is 9 digits
    in same way sedol as 7 digits always in same row and if you observe no other data in same row is 7 digits
    and for div/coupon rate once it find isin,cusip,sedol then you can find the desired value in same column.

    the code should first detect the word ISIN in column A and it should search for 13 digit word in same row and it should pick up the value in another sheet as i mentioned in original sheet.
    then cusip,sedol,div/coupon

    this is not original data .it is sample data but original looks same as this ........ please let me know if you need any more details... thanks.....

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: help me to sort the data with v.b.a code

    Please try this code to see if you get the desired output. As you provided only one sheet so I copied the same data on two other sheets. Therefore this data will also reflect on the Report Analysis Sheet i.e. you will get three reports on the Report Analysis Sheet.

    Please Login or Register  to view this content.
    Please find the attached sheet and click on the Green Button on Sheet1 to get the desired output on Report Analysis Sheet.
    Attached Files Attached Files

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: help me to sort the data with v.b.a code

    Please add one more line of code just below these two lines of code
    Please Login or Register  to view this content.
    Line of code to be added.
    Please Login or Register  to view this content.
    This new line of code will clear the existing data from the Report Analysis Sheet if it already exists in the workbook otherwise the code will add a new Report Analysis Sheet in the workbook.

  8. #8
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: help me to sort the data with v.b.a code

    that's too good ............ thank you very much, that helped me a lot ........ i want to give you many ****** ......... and lots of smileys................ thank you very much.............

  9. #9
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: help me to sort the data with v.b.a code

    But one thing in sheet 2 there are 4 securities but when i run a macro, in desired report it has taken only two can you please look in to it and adjust that.... please find the attached sheet for reference.......... and there are lot of securities in original data in both the sheets, so macro should go to end row to pick up all securities can you please make that adjustments to the code............ thanks in advance..........
    Attached Files Attached Files
    Last edited by boddulus; 10-04-2014 at 10:22 AM. Reason: attaching sheet

  10. #10
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: help me to sort the data with v.b.a code

    You're welcome. Thanks for the feedback.

    On Sheet2 there are 5 securities not 4 and two ISIN are of 13 characters, two ISIN are 11 characters and one is of 12 characters. As you said your ISIN will always be 13 characters long and the code was looking for a 13 characters string in ISIN's row so it found only two. That's the case.
    I have made changes in the code to pick the string which is more than or equal to 10 characters.
    The changed part is in red color in the code, so you can change it as per your need.
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: help me to sort the data with v.b.a code

    oh i am sorry it was my fault..... i didn't notice it....yes the isin will always be of 13 digits but since i manually enter the data there was a mistakes in sheet 2................... anyway thanks for your help..... i will mark this thread as solved.... thank you very much once again for your help ...............

  12. #12
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: help me to sort the data with v.b.a code

    You're welcome. Glad I could help.

  13. #13
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: help me to sort the data with v.b.a code

    Hi Sktneer,

    Can you please help me out,

    can you please modify the above code in such a way that macro should find cusip ,sedol and div/coupon rate same like ISIN... since i found in the original sheet like some doesn't have cusip,some doesn't have sedol and some doesn't have Div/coupon rate... please find the attached sheet for reference...

    and also i want to know from which sheet the isin or cusip or sedol came . i mean macro should automatically give name of sheet in that 2 blank in report analysis sheet... please find the sheet for reference....
    Thanks for your help in advance ........
    Attached Files Attached Files

  14. #14
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: help me to sort the data with v.b.a code

    please upload the sample workbook with the desired output shown on another sheet and highlight the cells in question on raw data sheets where you don't find these values. Let me know what output you are expecting if any value is missing for a sub-set. Show the desired output which is completely meets all your requirements.

  15. #15
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: help me to sort the data with v.b.a code

    please help me out ........ i have attached the sheet with explanation in the sheet.... please let me know if you need any thing else...

    thanks for your help and patience...............

    Please see the comments in raw sheet and Report analysis sheet.....
    Attached Files Attached Files

  16. #16
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: help me to sort the data with v.b.a code

    Please find the attached sheet to see if this works as per your requirement. I haven't matched the Report with raw data. Please match the Report Analysis Sheet with the Raw Data Sheets to see if you get the desired output.
    Notice some of your ISINs are less than 13 characters, so I have modified the code to pick any ISIN which is >=10 characters.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: help me to sort the data with v.b.a code

    Hi Sktneer,

    yes this will work..... i have compared it and it is working fine... thanks for your help again...... you have been a great help to me thanks for that..............

  18. #18
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: help me to sort the data with v.b.a code

    Hi sktneer,

    One more question.... i have been trying to learn V.B.A coding from past 20 days .. i have brought books like Excel 2013 power programming with VBA and started reading them. i work cognizant (investment banking) in Hyderabad and my lot of work is involved around excel . i know that there is no easy way to learn these things except doing hard work.... so i when ever i get time i will sit with that book or watch online solutions or watch you tube videos about excel programming , so can you please suggest me some tips how to learn and master these stuff..... i know excel formulas and other basic stuff but i want to master these VBA coding like you people..........

  19. #19
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: help me to sort the data with v.b.a code

    i really want to give a star and add reputation for your help but i don't know it is not allowing me to do. its popping up as "You must spread some Reputation around before giving it to sktneer again". any way it was great help and lot of patience from you .... i really appreciate and thank you for that........

  20. #20
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: help me to sort the data with v.b.a code

    Never mind. Its good to know that your issue has been resolved.

+ 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] How to sort the data by item code first, then sort them by date?
    By Zecond in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-04-2013, 01:55 AM
  2. Using VBA Code to sort my data automatically
    By ssincerely in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-10-2013, 02:12 PM
  3. Data Sort Code Issue
    By tommyfernandez in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-19-2012, 03:46 PM
  4. Code Help Needed to Sort Data
    By Lynn McCurdy in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-21-2011, 01:11 PM
  5. Sort Data without using code
    By Newbie - again! in forum Excel General
    Replies: 4
    Last Post: 12-12-2009, 10:25 PM

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