Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / October 2006

Tip: Looking for answers? Try searching our database.

IF statements - use to insert/delete rows?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
WRM - 20 Oct 2006 20:07 GMT
I know how to use IF statements to have do calculations or insert text or
numbers based on whether the IF statement is true or not.  Is it possible to
construct an IF statement that would physically change the spreadsheet?  For
example, IF <something is true> insert a row?  Or do you have to get into VBA
to do things like that?
Dave F - 20 Oct 2006 20:13 GMT
Depends what you mean by "physically change the worksheet"

If, by that phrase, you mean your example of inserting a row, then, yes, you
would need VBA.

It's hard to give you a better answer than that without you giving us a
specific example of what you're trying to accomplish.

Dave
Signature

Brevity is the soul of wit.

> I know how to use IF statements to have do calculations or insert text or
> numbers based on whether the IF statement is true or not.  Is it possible to
> construct an IF statement that would physically change the spreadsheet?  For
> example, IF <something is true> insert a row?  Or do you have to get into VBA
> to do things like that?
WRM - 20 Oct 2006 21:30 GMT
I meant not changing text/numeric values, but specifically, inserting a row
when a specific condition is met.

My issue is I have a sheet where each row represents a school's enrollment
over the last four years.  For example "ADAMS SCHOOL" will have a row for
2006, 2005, 2004, 2003.  But some schools may have just opened and only have
one year of operation (or two or three).  

What I want to do is to set up another sheet which show each school with
four rows - whether or not there is data.  I'm trying to avoid manually
working my way down the entire sheet, inserting rows, and was wondering if I
could set up an IF statement that would be along the lines of:  IF
<condition> INSERT ROW.  I have a pretty good idea how to set up the
condition part of the IF statement, but don't know if there's any way to give
a command within the IF statement that would insert a row.

> Depends what you mean by "physically change the worksheet"
>
[quoted text clipped - 11 lines]
> > example, IF <something is true> insert a row?  Or do you have to get into VBA
> > to do things like that?
Pete_UK - 20 Oct 2006 20:35 GMT
If you want to avoid using VBA, then you could achieve this with a bit
of manual intervention. Suppose your IF formula returned "delete" in a
column of cells if the row needed to be deleted - you could apply a
filter to this column and select "delete". Then, by highlighting the
visible rows and choosing Edit | Delete Row you can get rid of them in
one operation.

Hope this helps.

Pete

> I know how to use IF statements to have do calculations or insert text or
> numbers based on whether the IF statement is true or not.  Is it possible to
> construct an IF statement that would physically change the spreadsheet?  For
> example, IF <something is true> insert a row?  Or do you have to get into VBA
> to do things like that?
WRM - 20 Oct 2006 21:40 GMT
Good idea - actually, I need to insert rows, not delete (I've just posted my
specific issue in reply to Dave F's comments).  I'd only insert a row when a
certain condition is met.  I'm just trying to avoid scanning through about
800 rows and inserting a row as necessary.  I may just have to bite the
bullet, though.

> If you want to avoid using VBA, then you could achieve this with a bit
> of manual intervention. Suppose your IF formula returned "delete" in a
[quoted text clipped - 12 lines]
> > example, IF <something is true> insert a row?  Or do you have to get into VBA
> > to do things like that?
romelsb - 21 Oct 2006 20:55 GMT
Excuse me Pete N Dave...WRM...u want to insert a row in a worksheet which
represent one school...Why ? If you insert one row, it means there is a new
school that enters in your worksheet...u have now 800...how many sxhools do
you expect to be entered in the Worksheet ? I guess the rate of entry of rows
will be so slow...u may wait for another excel version probably to insert
more ? maybe you can just fill-in below the blank row and filter-sort if u
wish. As u said "inserting a row AS NECESSARY"...

> Good idea - actually, I need to insert rows, not delete (I've just posted my
> specific issue in reply to Dave F's comments).  I'd only insert a row when a
[quoted text clipped - 18 lines]
> > > example, IF <something is true> insert a row?  Or do you have to get into VBA
> > > to do things like that?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.