+ Reply to Thread
Results 1 to 18 of 18

How to do auto sorting

  1. #1
    Registered User
    Join Date
    08-30-2011
    Location
    MALAYSIA
    MS-Off Ver
    Excel 2010
    Posts
    10

    How to do auto sorting

    Hai guys and girl...
    I need some help on excel auto sorting. As you can see from my workbook on sheet 1. there is 5 header on different rows. this rows wont be change unless for the row of g3. this rows will get autoupdate of price from my trading software. And in sheet 2, here come the problem i get. I try to get auto sorting the price from largest to smallest. And the currency pair will move along with the profit and loss next to it. So it like all the positive will stay above and negative will stay below along with the currency pair.

    Your help is appreciate.
    Attached Files Attached Files
    Last edited by calvk81; 09-01-2011 at 09:40 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,297

    Re: How to do auto sorting

    Hi calvk81 and welcome to the forum.

    If you are talking about sheet1, you need to remove the blank column between Daily Open and Current Price. That way Excel will know all the rows stay together when you autosort.

    See http://www.easyexceltutorial.com/excel-tables.html for a good example.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    08-30-2011
    Location
    MALAYSIA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to do auto sorting

    Quote Originally Posted by MarvinP View Post
    Hi calvk81 and welcome to the forum.

    If you are talking about sheet1, you need to remove the blank column between Daily Open and Current Price. That way Excel will know all the rows stay together when you autosort.

    See http://www.easyexceltutorial.com/excel-tables.html for a good example.
    hai marvinp
    thanks for your reply. Sorry if i dont write it correctly. Actually sheet2 is the place i need to use Autosort. As you could see from sheet2, there is 14 currency pair. And This is fix. And the value beside the currency pair will always changing. And i need the currency pair with the highest to smallest value. So that is the positive will be above and negative will stay below. And those pair will be always moving depending on the value in sheet1. That is the sheet i will entered my data manually.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,297

    Re: How to do auto sorting

    Hi,

    See the attached with 3 pivot tables on sheet2. If you change the data on Sheet1 and do a "Refresh All" on one of the Pivot Tables it will reflect data on sheet 1 correctly.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-30-2011
    Location
    MALAYSIA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to do auto sorting

    Hai marvinp. Thanks for your help. Because the value i get from my trading software will update every second. So i hope it can do in auto sorting. I have make a new sheet. I hope you could help me to fix it. As you could see, the range C3:D7 is the place that i want it to do auto sorting from highest to lowest. And column H is the place that i will get data from my Trading software. As the value change in column H, the range C3:D7 will sort in descending value. I have copy some macro but just cant get it working. Hope that you could help.
    Thanks
    Attached Files Attached Files
    Last edited by calvk81; 08-31-2011 at 08:15 AM.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,297

    Re: How to do auto sorting

    Hi Calvk81,

    Look at the attached that will sort the pivot table when things in column H change. Look behind sheet1 at the event macro that does the refresh.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-30-2011
    Location
    MALAYSIA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to do auto sorting

    Quote Originally Posted by MarvinP View Post
    Hi Calvk81,

    Look at the attached that will sort the pivot table when things in column H change. Look behind sheet1 at the event macro that does the refresh.
    marvinp
    thanks for your quick response. Actually the sort order i would like this.
    when i change the value in column H. The value in column D will auto sort it in descending way. So, if next time i change the values in H17 44 to 10. The GBPUSD will move to step3 and EURUSD will move to step1 and USDCHF will move to step2 and so on.
    Attached Files Attached Files

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,297

    Re: How to do auto sorting

    Hi calv81

    Look at my last attachment. I think that is what I did. Look at PT Event Sort.xlsm again.

  9. #9
    Registered User
    Join Date
    08-30-2011
    Location
    MALAYSIA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to do auto sorting

    marvinp
    thanks for all the work you have done.That i have to do it manually. right now, when i change the column h to receive the values from my MT4 software. It will not update automatically. Is there a way to make it auto refresh every 10 seconds?
    Attached Files Attached Files

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,297

    Re: How to do auto sorting

    Hi,

    Did you see the code behind sheet1? It will only trigger if you change one of the cells between G16 and H20. If you are entering values below that in column H then change the 20 to the last row you will enter data into.

    Other than that - if you are already running VBA code to pull in data, simply add a line of code after it pulls stuff in of
    Please Login or Register  to view this content.
    and that will update the Pivot Table.

  11. #11
    Registered User
    Join Date
    08-30-2011
    Location
    MALAYSIA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to do auto sorting

    Quote Originally Posted by MarvinP View Post
    Hi,

    Did you see the code behind sheet1? It will only trigger if you change one of the cells between G16 and H20. If you are entering values below that in column H then change the 20 to the last row you will enter data into.

    Other than that - if you are already running VBA code to pull in data, simply add a line of code after it pulls stuff in of
    Please Login or Register  to view this content.
    and that will update the Pivot Table.
    what if the range h16:h20 (this is the main data, wont be adding anymore data) remain unchange? Just only the value inside it will change every 10 seconds? Exp. The value of EurUsd is 1.2345 right now, the next second it change to 1.2350. But the value in pivot table will not change to 1.2350 unless i press the refresh on excel.

  12. #12
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,297

    Re: How to do auto sorting

    The way the event macro works is to fire when data in that range changes. I guess your software doesn't trigger a change event. SO - add a line in your software to the above so you won't need to press the refresh.

    Without having or using your other software that updates your data, I really can't test my answer.

  13. #13
    Registered User
    Join Date
    08-30-2011
    Location
    MALAYSIA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to do auto sorting

    Quote Originally Posted by MarvinP View Post
    The way the event macro works is to fire when data in that range changes. I guess your software doesn't trigger a change event. SO - add a line in your software to the above so you won't need to press the refresh.

    Without having or using your other software that updates your data, I really can't test my answer.
    Marvinp
    do u really could help me to test on the software. If you busy, that wont be a matter. The software is really actually a trading software called metatrader 4. It can freely download on anywhere on the net. That is the software that i receiving the values from.

  14. #14
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,297

    Re: How to do auto sorting

    Hi calvk

    I have no desire to download and install metatrader 4. Sorry. Perhaps some other forum member will want to help with this.

  15. #15
    Registered User
    Join Date
    08-30-2011
    Location
    MALAYSIA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to do auto sorting

    Quote Originally Posted by MarvinP View Post
    Hi calvk

    I have no desire to download and install metatrader 4. Sorry. Perhaps some other forum member will want to help with this.
    Ok marvinp.
    thanks for your help. Just only one last question. If i put the pivot table on sheet4. Could i do a macro to refresh the sheet4 on every 30 seconds? Cause when i press the refresh button under the pivot tools - options - refresh. And the values will refresh. If i could automate this process, then i think everything is settle. Thanks for your help till now.

  16. #16
    Registered User
    Join Date
    09-01-2011
    Location
    New York, United States
    MS-Off Ver
    CT
    Posts
    1

    Re: How to do auto sorting

    Best way around it would be to write your own sorting algorithm, then apply the resultant sort order to all the linked sheets. ie. Don't use the Excel auto sort.





    _____________________
    POS System

  17. #17
    Registered User
    Join Date
    08-30-2011
    Location
    MALAYSIA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to do auto sorting

    marvinp
    i just find a macro that will do refresh when the values update. but i cpu is running on heavy load.
    Please Login or Register  to view this content.
    could you help me to add some time interval like it will refresh at 1minute.

    thanks

  18. #18
    Registered User
    Join Date
    08-30-2011
    Location
    MALAYSIA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to do auto sorting

    Quote Originally Posted by toddgold View Post
    Best way around it would be to write your own sorting algorithm, then apply the resultant sort order to all the linked sheets. ie. Don't use the Excel auto sort.
    toddgold
    thanks for your reply. Actually i am a total noob in excel programming. i also hope to learn how i could do the trick.

+ 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