+ Reply to Thread
Results 1 to 8 of 8

Regarding selection of every 4th row from a huge excel datasheet...

  1. #1
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    Regarding selection of every 4th row from a huge excel datasheet...

    Hi,

    I have a excel data sheet with 10000 rows and 25 columns. Now, i want to reduce it by selecting every 4th row, can any one please help me in regard of this issue.

    I exported the excel sheet into microsoft query and i am ok with importing excel table into microsoft query software, but i am not sure of writing SQL query for selecting every 4th row...if it is possible that way, can anyone send me the query form please..

    Thanks in advance, i appreciate that..

    Bye
    Sathish.K

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064
    Does it have to be via SQL? I don't know a great deal about SQL.

    You want some form of record counter and an INTeger function.

    Each time you read a record add 1 to this record counter

    Then calculate

    If INT(variable / 4) * 4 = variable

    So something like (remember I dont know SQL)

    SELECT data FROM file
    Temp1 = Temp1 +1
    Temp2 = INT(Temp1 / 4) * 4
    WHERE Temp1 = Temp2


    When Temp2 = Temp1 the record count is a multiple of 4, therefore you are selecting every 4th record only
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481
    Hi there,

    Here's a cheap 'n' cheerful way of deleting every fourth line.

    Enter the following code in a VBA module of your workbook:

    Please Login or Register  to view this content.
    where:
    intFirstRow is the number of the first row which contains data
    lngNoOfRows is the number of data rows
    strColumn is a new column which will receive "DELETE" markers.

    You can alter the above parameters to suit the layout of your data worksheet.

    Run the "MarkRows" routine - this will enter "DELETE" on every fourth row - you can then check that the appropriate rows have been marked for deletion.

    Now run the "DeleteRows" routine - this will delete every row which was marked for deletion by the "MarkRows" routine.

    Hope this helps - please let me know how you get on.

    Best regards,

    Greg M

  4. #4
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    hey Greg M thank you....

    Thank you very for your valuable code man...This helped me alot, I appreciate your help man...It saved me hell a lot of time...

    Have a great day man...

  5. #5
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481
    Hi again Skonduru,

    Many thanks for the feedback. You're very welcome - delighted to have helped.

    All the best,

    Greg M

  6. #6
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    hey Greg...

    i have one more question...

    Do u have any idea about data reduction techniques in excel...i.e, as i said i have huge data, when i plot this data into excel sheet i am getting very zigzag curve(not smooth)...Actually i want to get the smooth curve, after getting smooth curve i want to filter out the data on the smooth curve...to be brief i want to eliminate the erratic data by using some data reduction r mining techniques what ever it is in excel r any other software...

    Thank you..

    Sathish.K

  7. #7
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481
    Hi again,

    I've never had occasion to get involved with such large quantities of data & so smoothing was never really an issue for me.

    The best I can do at this stage is to suggest that you look at "Smooth the angles of line charts" and "Exponential Smoothing analysis tool and formula" in the Excel Help menu.

    Sorry I can't offer anything more.

    Best regards,

    Greg M

  8. #8
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    hi

    not a problem...thank you very much...

+ 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