+ Reply to Thread
Results 1 to 32 of 32

Transfer data from Input sheet to output sheet on condition

  1. #1
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Red face Transfer data from Input sheet to output sheet on condition

    Hello Experts,

    Need you assistance in transferring data from Input sheet to Output sheet on conditions..

    Please see the attached File..

    Input Sheet have Column C (Values as 1,2,3) & Data from (Column E to Column U)

    Now Transfer all Data from INput sheet to Output on below condition
    1) If "Column C" Cell value = 1 then copy that row to output sheet under row named ("1 TeraByte") from COlumn A to Column Q

    2) If "Column C" Cell value = 2 then copy that row to output sheet under row named ("1 MegaByte") from COlumn A to Column Q

    3) If "Column C" Cell value = 2 then copy that row to output sheet under row named ("1 TeraByte") from COlumn A to Column Q


    Initially for sample data i have inputted only 5 rows.. the data can be more hence the ouptut file layout should not undergo any change.. only the rows should be added in between the Row data header & the Subtotal...

    Also the Conditions are now for value = 1,2,3.. if it grows.. iw ill change the code accordingly...

    Puzzled


    Attached Files Attached Files
    Last edited by Parth007; 07-13-2015 at 06:00 AM.
    Regards
    Parth

    I appreciate your feedback. Hit * if u Like.
    Rules - http://www.excelforum.com/forum-rule...rum-rules.html

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Transfer data from Input sheet to output sheet on condition

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hi john,

    GRT it worked well on my sample sheet.. will run the same on My actual huge data earliest by tmrw & revert ..
    But puzzled as to how do i remove the old data first before i run this code..
    It will add the data on every run..

    can we just delete the existing data from Output sheet (Not the Headers rows & Sub total row & then execute macro

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Transfer data from Input sheet to output sheet on condition

    Try:

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Perfect ..Thanks A ton.. its working ausome on sample data..
    Will check with the actual data by tomorrow & will revert

    Thanks a lot JOHN !!!!

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Transfer data from Input sheet to output sheet on condition

    You're always welcome. Hope it works for you on real data.

  7. #7
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hello John,

    It Did work fwhen i added one more condition....

    Before testing it on real data please let me know the addition & changes i done in code is correct or not..
    As in real data i have 20 conditions..


    Currently in sheet there were 3 rows..

    1 TeraByte
    2 MegaByte
    3 TeraByte

    I added one more condition..."4 TeraByte"

    and did Addition in the code


    I added

    Please Login or Register  to view this content.
    and where ever there was End(3).Row i Changed it to "End(4).Row"

    Please correct me if i am wrong.

    Below is the complete Code

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Transfer data from Input sheet to output sheet on condition

    Looks good to me.

  9. #9
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hi John

    Its not working.. coz their are 9 conditions & one row added in each block as per source file..

    Please check the attached file.. sorry for inconvinence

    code attached in module..
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Transfer data from Input sheet to output sheet on condition

    Try:

    Please Login or Register  to view this content.

  11. #11
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hi John,

    The data is getting duplicated on every run.. its not deleting previous data..its appending

    Moreoever the Row with value "Rated ID" should not be changed..
    It should be always there itself after every conditioned row..

    That is on Row 14, Row 28, row 37, row 46, 55, 64, 73, 82, 91 should not be moved..

    Plz suggest

  12. #12
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    If i run the code..

    It populates some data not all data..
    and after sometime it gives error..
    Type Mismatch at below line
    Case Is = 1

  13. #13
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hello John,

    I somehow got the issue why type mismatch error was coming.. i rectified it in the code you gave..

    Can you please help me for below

    (Hi John,

    The data is getting duplicated on every run.. its not deleting previous data..its appending

    Moreoever the Row with value "Rated ID" should not be changed..
    It should be always there itself after every conditioned row..

    That is on Row 14, Row 28, row 37, row 46, 55, 64, 73, 82, 91 should not be moved..

    Plz suggest)

  14. #14
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Transfer data from Input sheet to output sheet on condition

    I would not work with a fix Template Sheet cause that will be a hell to maintain.
    I would suggest to Create the Whole Sheet by Code cause the Design for every Section is always the Same.

    My Approach would be sth like this.

    Edit: For the Header Thingy before row 13 you could create a template and start with a copy of that

    1. create a Settings Sheet with a table ID/Name where you write 1/1 TeraByte
    2. Sort the Data on the input Sheet by Column C
    3. Create Blank Sheet
    4. grab the name from your helper Table write it to row 13 and rated ID in 14
    5. Loop through the Input Sheet until id is not 1 anymore and copy the needed columns to the new sheet
    6. End the section on the new Sheet with Rated ID Sub Total
    7. do that for all entrys in the helper table.

    I dont have so much time today but i could take a look at it tomorrow if you don't get a solution

    kind regards Loki
    Last edited by LordLoki; 07-09-2015 at 09:35 AM.

  15. #15
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hello John,

    I managed to make the code in working condition.. Its done.. Thank you so much for this Appreciate your efforts & suggestions...


    Thanks Loki for suggestion.. Its solved with little trick...

  16. #16
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    HI John.... i had to comment some lines of code in order to make it working on my huge data...

    Everything is working fine but the formulaes are not getting updated..

    The Row having "Rated ID Sub Total" outputs formula as =SUM(#REF!)

    can u suggest some code which will rectify only the =SUM(#REF!) and consider the range of cells values to add above it..
    The formulea are in column (J, M, O, P, Q)

    thank you...

  17. #17
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Transfer data from Input sheet to output sheet on condition

    cause i already done it (had nothing to do in the Train) :D
    This code is more dynamic and the result looks better then your Template :D

    If you use it have fun with it if not maybe it helps others :D
    Put some more comments in and added sumifs Formula to the template Sheet

    Edited the Code and updated the File



    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by LordLoki; 07-09-2015 at 12:25 PM. Reason: Updated something

  18. #18
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Transfer data from Input sheet to output sheet on condition

    Can you repost the working code you are currently using? So I can see what you have commented out.

  19. #19
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hi John, Below is the code with some commented.. bcoz i was getting error so i had to comment the last poarts of the code..
    I am successful in plotting all the data as per conditions with deletion of empty rows in it.. just left with formulaes to be plotted properly..

    Please Login or Register  to view this content.

    The formulea are in column (J, M, O, P, Q)
    & i am getting =SUM(#REF!)


    Dear Loki, thanks for the code.. your code also worked with the data in Input sheet.. but when i actually put all original Input data in sheet which is more than 10000 it does not pick all correct data in Output sheet.. & i have to keep the format consistent coz the sheet is just one part of macro.. more macro gets executed on it.. so cant move or delete anything unless necessary.. too much of confusion on the sheet.. coz fata is around 20,000 to 50,000
    Last edited by Parth007; 07-10-2015 at 04:01 AM.

  20. #20
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hi Loki,

    The code you posted worked perfectly on huge data too.. thanks for it

    John thanks too you too.. because your code too helped me built different output sheets

    Thanks a Ton experts !!!!!



    Quote Originally Posted by LordLoki View Post
    cause i already done it (had nothing to do in the Train) :D
    This code is more dynamic and the result looks better then your Template :D

    If you use it have fun with it if not maybe it helps others :D
    Put some more comments in and added sumifs Formula to the template


    Sheet

    Edited the Code and updated the File



    Please Login or Register  to view this content.

  21. #21
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hi Loki,


    I Sorted Settings sheet before running Macro..

    It executes well IF column have Only Integers as (1,2,3,4,5,6..)
    or column have only Characters values as (A,B,CC,D,F,E,R,MM)


    But for IF columns have values Numbers+ Characters+AplhaNumeric as (0,A1,A2,A3,NA,NR,WR,AA1,AA2,AA3,AAA,BA1,BAA1,BAA2,BAA3) it only populates data for A1, A2, A3 rests it fails & do not popualte anything after that... Please suggest
    Last edited by Parth007; 07-10-2015 at 07:07 AM.

  22. #22
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Transfer data from Input sheet to output sheet on condition

    Hi Parth,

    I found one thing that needs to be changed the last group did not get a Subtotal. therefore the Sum in the Top is not correct.
    I also changed the actid variable to string that works for all cenarios.
    Now it should work fine i testet with 100k input Data and got a perfekt result after 4 Minutes

    Greets
    Loki
    Attached Files Attached Files

  23. #23
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hi Loki, The issue remains same... .. It does not capture the Last sub total..
    Moreover it populate wrong data for first conditions

  24. #24
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Transfer data from Input sheet to output sheet on condition

    For me it works perfekt now.
    Did you adjust the Settings sheet when you try it with the Real Data?

  25. #25
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    If you execute this...
    We only get data for A1, A2, A3.. thats it.. i am puzzled what is stopping other to populate

    If this works.. i am done
    Attached Files Attached Files

  26. #26
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Transfer data from Input sheet to output sheet on condition

    Yeah figured it out.
    Sample Data was sorted nicely from 1 to 9 so that worked well.

    Is the order of items in the output sheet important?
    Then it will take a bit longer to fix.
    If the order is not of importance its fixed easier

    Greets
    Loki

  27. #27
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Transfer data from Input sheet to output sheet on condition

    another reason is that your data is upper and lower case mixed. in the Settings you did not set that up accordingly.
    If for you "AAA" is the same as "aaa" tell me than i can compare the ids uppercase

  28. #28
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hi Loki,

    The order of the data is not that important as of now.. More over if you can make everything in Uppercase even that will do
    Moreover if we add a new condition in the Settings sheet the subtotal does not gets captured for last condition...

    Please suggest Thanks You

  29. #29
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hello Loki, Even though if Sub total is not plotted that will also do.. just need the data to be in for each conditions..

  30. #30
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Transfer data from Input sheet to output sheet on condition

    Hi Parth,

    Did change the Process a bit.
    I create a backup of the Input
    Then i loop through the Input Sheet and delete the Cells that are passed to the Output
    Testet with a mix of Identifiers (0,AB and AZ6) and it worked well.

    Check with your Real data and report back
    Attached Files Attached Files

  31. #31
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Transfer data from Input sheet to output sheet on condition

    Hi Loki,

    I debugged, rectified it.. Bingo..

    Its Bang on Target... worked superbly.. Would write a seperate code to delete the Backup Input sheet.. as it will be no longer required..

    Thanks a Ton Loki
    Last edited by Parth007; 07-13-2015 at 05:58 AM.

  32. #32
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Transfer data from Input sheet to output sheet on condition

    You are welcome always happy if i can help

    for the backup sheet you can just not generate it at all then you don't have to delete it :D
    its just a backup the code does not refer to it at all.

    greets
    Loki
    Last edited by LordLoki; 07-13-2015 at 08:24 AM.

+ 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] Issue regarding recorded Macro to transfer data from Input sheet to Storage sheet
    By Hirad001 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-29-2015, 04:26 PM
  2. [SOLVED] Desire data segregate from “input” sheet to “output “sheet
    By nur2544 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-24-2014, 07:10 AM
  3. [SOLVED] Desire data extract from the sheet “input” to the sheet “output”
    By nur2544 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 06-24-2014, 02:19 PM
  4. How to transfer data from a daily input sheet to a separate monthly total sheet
    By Jcooper71 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2014, 02:37 PM
  5. Populate Output sheet based on input data and lookup condition
    By Cool\m/ in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-10-2013, 04:45 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