+ Reply to Thread
Results 1 to 6 of 6

deleting rows with decimal points (non-integers)

  1. #1
    Registered User
    Join Date
    07-09-2010
    Location
    Manila
    MS-Off Ver
    Excel 2003
    Posts
    2

    deleting rows with decimal points (non-integers)

    Hi All,

    I'm a macro newbie trying to create a macro for one of our work tasks. I need a macro that will delete all rows which contains a decimal point in column C.

    For example: the raw data in column c looks like this

    1
    1.1
    1.2
    1.3
    1.4
    2
    2.1
    2.2
    2.3
    3
    3.1
    3.2


    The output I need should look like this:

    1
    2
    3

    I hope one of your brilliant VBA users can help me out...
    Thanks in advance..


  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    re: deleting rows with decimal points (non-integers)

    Welcome to the forum.

    Instead of a macro ...

    If your data doesn't have a header row, insert one

    In B2, =MOD(A2, 1)=0

    AutoFilter col B for FALSE

    Select all the rows and delete

    Clear the AutoFilter
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    07-09-2010
    Location
    Manila
    MS-Off Ver
    Excel 2003
    Posts
    2

    re: deleting rows with decimal points (non-integers)

    Hi, my file does contain a header. Sorry was not able to include that detail. I actually need a macro for this, since it is not the only function in trying to incorporate to the file. I'm really having a difficulty deleting rows containning a decimal point (been stuck on this portion for 2 weeks now). thanks for the advise though..

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    re: deleting rows with decimal points (non-integers)

    How about recording a macro of the suggestion above, and then someone will help you clean it up?

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

    re: deleting rows with decimal points (non-integers)

    Insert a new column D next to C and create a formula in it
    =C2 - Int(C2)
    Copy this down through all your rows.
    Sort by column D and delete all rows with non-zero in D.
    It seems to me a Macro is overkill.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    re: deleting rows with decimal points (non-integers)

    A macro version of these ideas:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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