Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting Rows with Too Many of the Same Number


I have seven columns, A-G. All of these columns have different
quantities of whole numbers 1-7. I'd like to make a macro to go through
row by row and delete any rows that have more than 4 of the same numbers
in the same row. How would I go about doing this?


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=559436

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting Rows with Too Many of the Same Number


There's probably an easier way but this should get the job done:

Consider haivng an integer variable, one for each of the values fro
1-7 to store the occurance of the particular value in a row.
At the end of the row, if any of the variables have a value of 4 o
greater then delete the row.

of course this should be looped for each row and the variables ar
reset at the beginning of a new iteration.

Thats how I would do it. hope it helps

--
bail
-----------------------------------------------------------------------
bails's Profile: http://www.excelforum.com/member.php...fo&userid=3615
View this thread: http://www.excelforum.com/showthread.php?threadid=55943

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting Rows with Too Many of the Same Number


Thanks, I had thought about that, except I need to conserve system
resources. This program will be run on a LOT of rows, and I suspect it
will crash the computer or at least run extremely slowly.


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=559436

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Deleting Rows with Too Many of the Same Number

How about putting this in H1
=MAX(COUNTIF(A1:g1,A1:g1))
This is an array formula. Hit ctrl-shift-enter instead of enter. If you do it
correctly, excel will wrap curly brackets {} around your formula. (don't type
them yourself.)

And drag down.

Now you can just filter by that column to show 4 and delete the visible rows.

If you need a macro, you could record one when you did it manually.

Losse wrote:

I have seven columns, A-G. All of these columns have different
quantities of whole numbers 1-7. I'd like to make a macro to go through
row by row and delete any rows that have more than 4 of the same numbers
in the same row. How would I go about doing this?

--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=559436


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting Rows with Too Many of the Same Number


Thank you, that should solve my problem

--
Loss
-----------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...fo&userid=2481
View this thread: http://www.excelforum.com/showthread.php?threadid=55943

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting number and alphabet rows and coluns Maryann Excel Discussion (Misc queries) 1 May 17th 08 05:12 PM
deleting number and alphabet columns and rows. Maryann Excel Discussion (Misc queries) 1 May 17th 08 09:52 AM
Sequential number - adding and deleting rows Suzan Excel Discussion (Misc queries) 2 January 4th 06 09:36 PM
Deleting rows with repeated number Mark Lopa Excel Programming 2 March 4th 04 01:50 PM
deleting variable number of rows Nick Excel Programming 1 October 29th 03 04:31 PM


All times are GMT +1. The time now is 05:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"