I'm trying to create an IF THEN formula somewhat like this, if C2 does not = C3 then insert one (or two or three) rows then add C plus other C's in that range then show sum then insert one (or two or three) rows and repeat equation...MS Office, Excel 2007 & 2010.

Any ideas? Thanks.

You cannot use an Excel formula to insert rows. Excel formulas cannot perform "actions", they can only produce values (or errors) based on the result when the formula is evaluated.

If you want to insert rows based on the value in a cell, then you will need to use VBA (i.e. a macro).

That said, I don't know what you mean by

"if C2 does not = C3 then insert one (or two or three) rows".You stated one condition (C2<>C3) yet you've asked for 3 different actions (insert one (or two or three) rows). How would the macro know whether to insert 1 or 2 or 3 rows?

You will need to clarify what you are trying to do before we can offer any more assistance.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Ask Your Question

Weekly Poll

Do you think another person will land on the Moon by 2024?

Discuss in The Lounge

Poll History