Insert Row Based On Condition

Aug 12, 2009

I would like to write a code, that can check the name of cell A1 with A2.

If A1=A2, then insert a blank row between these two rows.

I have started with a loop, but somehow it does not work.

Sub AddRows ()

Dim Row As Long
For Row = 1 To 3800

If Cells(Row, 1).Value = Cells(Row + 1, 1) Then
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

End If

Next Row

End Sub

View 9 Replies


ADVERTISEMENT

Insert Row And Values Based Upon Condition

Apr 4, 2014

I need a macro I can run that will insert a row whenever Column A changes (from PPN A to PPN B to PPN C, etc.) and that will insert string values into the Cells as follows:

In all cases, the insert cell values into column A (PPN) will be the value from the previous cell and column B (CPN) will be 'LABOR'

Here's image of before and desired after:

Before:

PPNCPN
4AQ02SLAG
4AQ02SAND
4AQ02CHIPS
4AQ02PORTLAND
4AQ02ADMIX
4AQ02AUTUMN BLEND
4AQ02OVERHEAD
4AQ03SLAG
4AQ03SAND
4AQ03CHIPS
4AQ03PORTLAND
4AQ03ADMIX
4AQ03BETHEL BLEND
4AQ03OVERHEAD

After:
PPN CPN
4AQ02SLAG
4AQ02SAND
4AQ02CHIPS
4AQ02PORTLAND
4AQ02ADMIX
4AQ02AUTUMN BLEND
4AQ02OVERHEAD
4AQ02LABOR -insert row and populate cells here
4AQ03SLAG
4AQ03SAND
4AQ03CHIPS
4AQ03PORTLAND
4AQ03ADMIX
4AQ03BETHEL BLEND
4AQ03OVERHEAD
4AQ03LABOR -insert row and populate cells here

View 1 Replies View Related

Insert MS Word Doc On Condition

Feb 28, 2007

I have a workbook with about 8 sheets that is used for pricing vehicles with options.

On the first sheet is the list of about 40 vehicles. I would like to insert a command that IF the quantity of vehicle X = 1 (all others would be blank) then insert a MS Word document that contains the proposal.

The MS Word document could be a worksheet if necessary.

View 14 Replies View Related

How To Insert Some Rows On Condition

Apr 21, 2014

I want to get some blank rows in a worksheet after certain characters.i have some data in a sheet. at the end of each cluster of data it ends either with 1-0 or 0-1.

if excel finds 1-0 or 0-1 at the end of a bunch of rows, it should add 5 blank rows under it.then it should search for the next 1-0 or 0-1

If data ends on A25 where you find 1-0 or 0-1 then add 5 blank rows under it from A26:A30,likewise it should be given till it reaches the end of the range.range can be defined as A1:A1000

View 4 Replies View Related

Insert Cell On Condition And Move Right

Feb 5, 2007

I have made really huge downloads out of our SAP system (needed over 20 separate Excel files ;-). I need to analayze the data, but unfortunately the date is not 100% consistent as some cells are emtpy. Is it possible to have Excel look down a column, and have it insert a blank cell in another column on the same row where it found the empty cell? (and move the cells right a a result?)

I have attached an example of what Excel should do as it is hard to explain (as you can tell ;-). I am likely to spend the next days figuring out how I can best combine the data and analyze it!

View 2 Replies View Related

Insert Rows By Condition & Copy Data Above

Mar 8, 2008

I deleted the data and made up some figures but kept the format to protect privacy. Highlighted blue and green because it's possible to have the same name have 2 different types. I put in dashed lines to more clearly divide months.

1. For each UNIQUE "Name" and "Type" add a new row starting from last entry
2. Copy A,B,C to new row
3. Copy LAST (most recent) "End Balance" from column "I" corresponding to last person
4. Copy column "I" formula into new role

So Name, ID#, type, column D and the formula in "I" (excluding "Name" and "Type" duplicates) should be added to the end of the sheet with their new row

Unsure if possible:

5. Make old amounts (columns D,F,H,I) not count towards the totals
6. Totals reflect new amounts only so values aren't counted multiple times

exampleforforum.xls

View 2 Replies View Related

How To Count Condition Based On Having Another Condition

Apr 12, 2014

So I have one sheet that needs to pull data through to another sheet (which is a stats summary)

I have a drop down list containing 4 options all of which have to be counted separately on the stats summary sheet. However I only need them counted when a value is input in another cell in that row.

For example: I select option 1 from down down menu, but I only want this to be counted on the stats page when I enter a date in the "date" cell.

View 9 Replies View Related

Sum Based On Condition

Dec 15, 2009

I want to total column C, but only where column B contains certain data, like add column C where column b contains abd so that i get the answer 7, Hope ive explained it right.

B C
abd 1
abd 2
bmr 3
abd 4
crc 2
crc 3
bmr 2

View 2 Replies View Related

Set A Formula Based On Condition

Mar 22, 2009

I have a column called Average and it have numbers from 0 to 100. I want to set a string on another column based on the value of Average. The condition is

< 50 is negative
= 50 is neutral
> 50 is positive

For example
Column A Column B
45 Negative
50 Neutral
80 Positive

View 4 Replies View Related

Inserting Row Based On Condition

May 4, 2009

I want to insert a line wherever I encounter a number. I have a range of cells in column "A" with invoices listed and at the end of each customer I have the total. At the total line (the number) I want to insert a line. Right now I can't figure out how get the cell value to recognize a number from a non-number data type (bolded area)

View 5 Replies View Related

Delete A Row Based On Condition

Dec 14, 2009

I want to delete a row in excel based on a condition.

The condition is as follows:

I have few rows in the excel where the columns 7,12,13,23 are same and column 24 in one row has some number and in some other row the column 24 is blank with orange color filled(the colorindex for orange is 44).

In this case I want the row with orange color filled in column 24 to be deleted.

View 11 Replies View Related

Vlookup Based On 2 Condition

Jan 28, 2009

i looking for function, which will give me a results if its the person good , bad and other (Y). It will look based on column A, but if will be more equal names in this column, it looks in the column surname (B) and return value from column (Y) in this row. But it can be more equal column B.

Here is an example:
Results what i want are in Z1,Z2,Z3

X Y Z
1 sue doe good
2 joe bond very good
3 mark no bad

SOURCE table
A B C
1 john doe good
2 joe black bad
3 sue doe good
4 mark black not bad
5 joe bond very good
6 mark no bad
7 kat doe bad

View 4 Replies View Related

Sum Row Based On Condition Refering To A Different Row

Dec 9, 2009

I have a problem with bringing up the data I need to cells in one row.

In row 1 I have dates:
23-Nov 24-Nov 25-Nov 26-Nov etc.

In row 2 Quantities:
2000 1500 250 750 etc.

In row 3 I have dates again (I need to start working towards these qty's): 20-Nov 22-Nov 25-Nov 25/Nov. I would like in column A of 4 row to sum all the qty's (row 2) if the date in row 3 is the same or smaller than in row 1 column A. But in column B and forward I want cells to sum qty's if the date in row 3 is the same as the one in row 1. I have tried : =sumproduct((A3:D3<=A1),(A2:D2)) for cell A4

and: =sumproduct((A3:D3=B1),(A2:D2)) for cell B4 and consequently for others. It comes back as zero value even if I see matching dates/qty's. Does anyone know what shall I change in my formula to make it right?

View 3 Replies View Related

How To Change One Condition Based On Another

Feb 2, 2007

I have a "if" statement that goes something like this:

=if(and(Function1),do this, if(and(Function2), do that, 0)

where Function 1 and Function 2 consist of three conditions each.

Now Function 2 has reference to a particular cell (U23), whose value is dependent on other cell references.

If U23 has some real value, I want the above statement to be executed.

However, if U23 displays a "#N/A", I want only Function1 to be executed. i.e. = if(and(Function1),do this,0)

View 9 Replies View Related

Subtotaling Based On A Condition

Sep 27, 2009

I autofilter a list which contains, among other fields, program numbers in column A, account numbers in column B and dollar amounts in column E. I want to display the filtered/subtotal of column E if I select a certain program. Each program has account numbers ranging from 1000 to 8999.

I used =SUM(IF()) formulas to separately display totals with account numbers below 8000, and >7999 with no problem. But when I got to create formulas to display the subtotal, I encountered difficulty.

I used the following CSE formulas to subtotal sum of column E based on the values in column B, the first formula return 0 (zero), which is incorrect. The second formula appears to ignore the IF statement, and returns the total sum instead of the filtered total.

1. {=IF($B$4:$B$112>7999,SUBTOTAL(9,E$4:E$112),0)}

2.{=IF($B$4:$B$112

View 8 Replies View Related

Maximum Based On Condition

Dec 28, 2006

function that can find the maximum value in a range, where the range is defined by the rows containing a specific string, i.e:

In column A:
Alm Rød
Alm Grøn
Alm Blå
Special Rød
Special Grøn
Special Sort
...

In Column B I have values for each of the above string names.

Now I would like to find the maximum value for the range with names starting with "Alm".

View 6 Replies View Related

Delete Row Based On Condition

Jan 19, 2007

i have an issue i need to delete entire row if a condition is met, i need syntax if possible to delete if a cell word "begins with" a certain letter ...in this case...letter A

column is "O"
must search threw entire row

View 3 Replies View Related

Count Total Based On Condition.

Jan 18, 2010

I need a formula that will return a total for the number of cases that have been closed within 6 months. Also I need a percentage total for number of cases that have been closed within 6 months. So the conditions are that the case has been closed and within 6 months.

I tried to use a IF formula that returned a 1 if within 6 months and a 0 if outside 6 months and then just SUM() the column, however for some reason that just returns 0. I am using Excel2003

View 4 Replies View Related

Filter Based On Multiple Or Condition

Nov 6, 2013

Is there a way to filter data based on multiple OR condition with a like parameter.

I have data which has near about 50000 rows and now i would like to filter on a header called "Activity Type" and would like to fetch result for a text which resembles "from ABC group" or "From PQR group" or "From XYZ group".

View 5 Replies View Related

How To Have One Cell Copy To Another Based On Condition

Mar 10, 2014

I'm trying to set it up so that if a particular cell has any data in it, the contents of a different cell get sent to another. I want the no data/data to serve as a trigger.

As an example, if I put anything into cell A3, I want the contents of cell A1 to copy to H1. I'd also like it to be dynamic so that if I put something into cell B3, the contents of B1 get copied to H1, etc.

View 4 Replies View Related

Autofill Based On Cell Condition

May 20, 2014

I have a workbook sheet change condition that, when triggered runs the following code (amongst others).

[Code] ......

What I would like is to amend the above (possibly in a loop?) so that it skips the rows in which the value "New" features in range F17:F190.

So basically Autofill as per the code but leave the values in the cells of the range in which New features in range F17:F190

View 4 Replies View Related

VBA To Delete Entire Row Based On Condition Met?

Jun 16, 2014

I have table in which against the Column A data values are added in Column B, C and D.

If Column B,C and D cell values is 0, then I want entire row including A to be deleted. How can I do this in VBA?

Note: Column A data begins from Row 15 and below.

Just to avoid confusion. I want row deletion, only when all the three cell on B,C and D is = 0

View 7 Replies View Related

Highlighting Range From A:I Based On Condition

Mar 14, 2014

I have a file in which I have data from A9:I50.

In the column C i have the type mentioned either MTC or SELF.

If the value in column C is SELF then I want to highlight the corresponding rows from A:I.

[Code] ......

This code is colouring the entire row.

I want it to be highlighted from A to I.

View 2 Replies View Related

Coloring Cell Based On Condition

Jan 18, 2009

I had an report and the rows of the report needs to be colored based on another cell value. My layout looks like this:

A1B1C1D1AVG
1011121330
14151617100
18192021400

For each cell, i need to compare the value of cell with that value in AVG coloumn and if condition is met, cell should be colored. Eg : If first cell value under A1 is Less than 0.2 * AVG of first row then color of the cell A2 should be red. After coloring the entire rows, then i should check and color the header row based on the color of Rows.

I tried first one, i,e coloring the rows based on conditional formatting and then written VB code to compare the color of rows and colored the header row. But the color index used in conditional formatting and the code are mismatching and the desired output is not coming.So decided to write code for coloring the rows cell.

View 4 Replies View Related

Cut &Paste Based On Condition W/ Macro

Feb 18, 2009

I have a spreadsheet that I need to cut and paste data from one tab to another but only from columns B:K (as the spreadsheet has formulas that can not be alterred after column K. It must also paste that data for the hidden columns.

The condition on the data to be pasted in based on the tabs along the bottom.

So for example, anything that says Corn Products needs to be cut from the "standard customers" tab and moved to the Corn Products tab, and so on for the additional tabs.
I then need to un-check (hide) Blanks from the filter on the Standard Customers tab.

If possible, I would like run the Subtotals function in this same macro; the conditions for that are as follows

For each change in Shipper, Subtotal Billing for <<month>> (Column S)
Page break inbetween each Change in Shipper, then I would also like each subtotal figure bolded.

Also, this is something I must do every month, and each customer may have more or less lines or no lines at all in any particular month.

View 14 Replies View Related

Macro For Enter A Value Based On Some Condition

Mar 4, 2009

Currenty i am designing accounting related excel design. In that i need one macro for entering the value in a table based on some condition. I explaine the concept behind this, could some one able to help mean please share the information

I have a xls worbook with two sheets.
in the first sheet contain the column for entering the values.
in the second sheet having one small table withdate and Numbers.

i need to enter the values in the first sheet S.NO, Date and Value. when i enter the value in the first sheet, the date and S.No is compared to the second sheet table Date and the S.No and the value should be placed in the appropriate cell.

View 9 Replies View Related

Delete Entire Row Based On A Condition

May 13, 2009

I have a problem deleting rows based on a condition, i didn't know how to use offset method.

i'm using a table like this one :

A B C
1 Main design1 FFR0
2 Extra design2 FFR0
3 Main design3 FFR0
4 Extra design4 FFR0
.
.
n Main designn FFR0


I want to delete entire row if "FFR0" in column C exists in a row beginning by "EXTRA" (column A)

View 6 Replies View Related

Create An Automatic Pop-up Based On A Condition

Jun 15, 2009

I have an Excel file with multiple worksheets. 4 of these worksheets have the same format and have concatenate formulas in cells D14 through D28. What I need is an automatic pop-up message to tell me when I open the file if on any of these 4 worksheets text is generated from the concatenate formula that matches either "air cooling unit", "air heating unit", or "ceiling".

And, if so, I need for the pop-up to state the name of the Worksheet/tab and which of the above text strings match. For example, if one tab is named "6-5-09 C" and within the range of D14:D28 the text "ceiling" is listed, the pop-up should read something like, "Maintenance Needed for ceiling on 6-5-09 C!" If there are multiples on multiple worksheets, then I'd want all of them listed on the same pop-up. Then I would want to be able to click OK or CLOSE to close the pop-up. If I can even color the pop-up a color different than the regular gray, that'd be cool too.

View 2 Replies View Related

Delete Rows Based On A Condition

Jul 20, 2009

Is it posibile to make a macro that automaticaly delete rows based ona a condition. Condition is to delete rows that have B column value "" or zero. For example:....

View 12 Replies View Related

Concatenate 3 Cells Based On Condition

Nov 2, 2009

In the workbook, 3 columns of importance Column N,S and AC. Concatenate order ("S"&"N"&"AC") - combine it and show value in column AG. Column AC has either 0 or any other number (50,60,100 etc). If it is 0 I need to insert an 'F' at the end of the code in column AG, any other numbr and i need an 'O'.

Column N has contract code, this will be in the middle, usually its alphabets like RF,EF, but sometimes numbers like 21,33, etc but when its a single digit number like 6, i need it changed to 06 (need the 0 infront). Column S has exchange codes, and this has to appear in the front of the code in Column AG. Same as Column N, if there is a single digit number then put a 0 infront of it.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved