Macro - Fill Formula Down Until Adjacent Cell Contains String

Jul 17, 2014

I've created the following Macro based on some of the posts on this great forum! It works great, but I'd like to tweak it for another purpose where it would fill the formula down until a cell in column AF had the value "#N/A" or stopped having the value "clean". The #N/A is from a formula result so I'm not sure if or how the Macro would treat this.

Code:
Sub Y_CleanUp3()
'
' Clean Up Bad Data Macro 3
Dim LR As Integer
Range("AH2").Formula = "=VLOOKUP(X2,'[Territory by Zip Code.xlsx]Sheet1'!$A$2:$B$135000,2,TRUE)"
LR = Range("AF" & Rows.Count).End(xlUp).Row
Range("AH2").AutoFill Destination:=Range("AH2:AH" & LR), Type:=xlFillDefault
With Range("AH2:AH" & LR)
End With
End Sub

View 2 Replies


ADVERTISEMENT

Auto-Fill Formula When Adjacent Cell Changes

Jan 6, 2007

what is prompting this formula to auto fill down when a value in an adjacent cell is entered.

In column A I enter an unformatted fax number.
In column B I use the following Text Formula:
"="("&LEFT(A20,3)&")"&MID(A20,4,3)&"-"&RIGHT(A20,4)

Someone in my office copied the workbook and now any time a value is
entered into the next available Column A cell. The cell in column B will automatically apply the above formula and format the fax number. The person who copied the workbook does not know how this is working nor does anyone else in the office.

There are no macros embedded in this workbook so no event is firing to cause this.

I have attached a small copy of the workbook called "Auto format1.xls"

How to use:
-Select cell B20 and not nothing is in it.
-Enter any 9 digits in A20 and B20 somehow
copies down the formula from B19.

how to duplicate this.

View 9 Replies View Related

Macro To Populate Cells With Formula Based On Adjacent Cell?

Mar 31, 2014

I have a spreadsheet with data populated down column B. This size will vary from day to day so is there a macro I can run that will populate Column C with a formula based on their being data in the adjacent cell.

View 2 Replies View Related

Copy Fill Color Of Adjacent Cell

Oct 22, 2013

I am setting up a schedule maker for a coworker, in which I have divided two columns into time in and time out for each day of the week. My coworker wants the cell to be highlighted red if the shift is a night shift (Begins after 4), and I used conditional formatting to set up both columns independently to evaluate if the value of their content is after 4 PM. However, this means if a shift starts at noon, but ends after 4, only the time out cell will be highlighted red, not a huge issue but it isn't aesthetically pleasing.

View 3 Replies View Related

Fill In Blank Cells If Adjacent Cell Has Value Then Do For Next Set Of Data

Feb 19, 2014

I'm trying every conceivable angle I can think of in vba and coming up empty. What I have is a spreadsheet similar to this:

Column A Column B

1. 1234567
2. 2345678
3. 3456789
4. 4567890 A0001
5.
6. 9876543
7. 9876543
8. 9876543
9. 1234578
10. 3456789 A0002

What I would like to do is to fill in B1:B3 with A0001 and B6:B9 with A0002. The number of rows in each set of data will vary, but the identifier (A000X) will always be located in the row in column B adjacent to the last entry for that set of data in column A and there will always be empty cells between data sets. The number of data sets will also vary.

View 5 Replies View Related

Add Formula To Cell & Fill Down Macro

Jun 12, 2008

I have written a macro that creates a new spreadsheet and copies text into it. The number of rows varies depending on the input.

Yet, running the macro results in a sheet with the max rows (65k+). This is unmangeable, as it makes it a huge file and size and harder to print.

I only want there to be the number of rows that have text in them.

The larger problem is how these were even created in the first place. Currently:

' Formula for Job Name
Range("A2").Select
ActiveCell.FormulaR1C1 = "=LEFT(RC[12],8)"

' Fill Job Name
Range("A2").Select
Selection.AutoFill Destination:=Range("A2", Cells(Rows.Count, "A")), Type:=xlFillDefault

View 3 Replies View Related

Can I Fill Non-adjacent Cells With The Fill Feature? (example Listed)

Nov 7, 2008

how to enter data in non-adjacent cells using a fill command.

Here is what I am trying to do:
in the column, I am holding ctrl button to select every 10th cell down the sheet. I need to enter a date in every selected cell that is exactly 7 days apart, i.e., 11/7/08 then 11/14/08 then 11/21/08, etc.... but no other dates or data.

I have tried to figure out a way to do this other than manually, but am confounded.

View 9 Replies View Related

Find All Row Values Selected In Multi Column ListBox & Fill Adjacent Cell

Apr 27, 2009

I have a listbox that has row and columns. The rows are combinations of options and the columns are Additives.

After selecting a row in Listbox1, (first column are names) i would like the value of the second column to goto a specific area.... find that value and in the cell to the right of it place a "Y". The "Y" would indicate that "yes" it was part of the selection row of the listbox. Same for third column, forth, fifth and sixth. The result from the listbox is a number of Y's and N's in the result page. Then making all that were not part of selected line and equal to "N" to hide row (height = to zero).

Listbox and expected result are in attached example worksheet.

The attached does show the need much better then I can explain it.

View 9 Replies View Related

Create Macro Code That Auto Fill Cell With Formula?

May 23, 2014

When I enter data in the cells A1 and B1, C1 needs to calculate the result. (not copy and paste)

For examle: I have formula C1=(A1+B1)/2

C column for formula, but shows result only when there is a data in A and B

View 7 Replies View Related

Find Text String And Adjacent Cell Contents

Feb 20, 2008

I would like to find a text string in a document, move the information in the cell to the right of this to another cell (say A1).

View 8 Replies View Related

VBA To Fill Cell Values Based On Adjacent Cell Values

Jun 5, 2014

I request you to write a code for me to fill the cell values as "Not Applicable" in Column "AZ", if the "B" Column cell values = "Justified", "Approved LSAR" & "Approved SDAR".

I have attached the work book of what I am trying to accomplish.

View 14 Replies View Related

Copy Any Bold Text Within Cell Text String To Adjacent Cell?

Jul 31, 2014

Here's an interesting one:

A1 contains a text string which is both bold and unbold (
B1 is blank

I need a macro which scans the cells with text and copies the BOLD portions of the text string into the adjacent cell.

Example:

A1
The sky is blue

Macro is run

B1
sky blue

View 11 Replies View Related

Formula To Add Adjacent Cell

Apr 22, 2014

I am wanting to add the value of an adjacent cell and keep the SUM in another cell... depending on that cell value.

For example: H10 value is "JW" .. so that number adjacent (G10) would be added to the cell G4 (next to JW), and same with "NK". If it says "NK/JW" then I need it to be divided equally.

N528MW Revised.xlsx

View 3 Replies View Related

Display Formula In Adjacent Cell

Mar 19, 2009

I want to display the formula in the adjacent box to where it is actually used. Would anyone happen to know how to get that done? Example:

If cell A1 contains the following formula: A1+ A2
I want cell A2 to show : '= A1+A2'

View 4 Replies View Related

Macro To Fill In A Formula In Each Row Where There Is A Value

Jan 8, 2009

I am looking for a Macro to fill in a formula in each row where there is a value. So if there is a value in row 1 Column A then place this formula into Column B and continue down the sheet untill there is not a value in Column A.

View 9 Replies View Related

Incorporate Adjacent Cell In Formula W/o Naming Cell Address?

Oct 2, 2009

I searched and I keep finding something that's not quite what I'm looking to do so I think I'm missing something really simple.

Let's say that I want each cell in col b to be the sum of 5 plus whatever value is in the cell adjacent to it on the left (col).

I know that you can just write a formula in each cell like...

b1 will be =sum(a1+5)
b2 will be =sum(a2+5)

... but is there a shortcut so that you don't have to write out the actual cell address for each one?

Meaning - is there a predefined name or something that represents the cell to the left or right so you can just use that instead, allowing you to just copy paste the same formula all the way down the column? Something like...

b1 will be =sum(left+5)
b2 will be =sum(left+5)

... where "left" represents whatever value is in the cell to the left of that particular cell?

View 9 Replies View Related

Formula To Search For One Word In Adjacent Cell?

Jul 8, 2014

I've got a long list of company names, i'm trying to create a formula to see if they match but the problem is the names won't match exactly (e.g it would be Joe Bloggs Limited & Joe blogg's ltd). I've thought about it and think the best way to see if they match would be to take the first word from the first cell (in this case Joe) and then search for it in the next cell and return TRUE if it exists anywhere in the cell and FALSE if not.

View 3 Replies View Related

Formula To Check Adjacent Cell Value, And Report.

Jan 5, 2009

Ok. I am creating item lists in excel for every product that my company sells. I am in need of a formula that does the following:

I want the cell to check to see if there is a value in another cell, and if there is anything at all, i want to display the word Yes as the value, or leave the cell empty.

So I want the cells in Column A to Check if the adjacent cells in Column B have a value. If the column b cells have a value I want the cells in Column A to display the word "Inventory Part". If there is no value I want the cell left blank.

View 7 Replies View Related

Find And Replace By Adjacent Cell Formula

Feb 4, 2014

Is there a formula that can find a keyword within a cell then replace it with a formula that will add the adjacent cell value up.

A1=103 B1=104
A2=104 B2=105
A3=105 B3=Out-1p-(1)
A4=110 B4=111
A5=111 B5=112
A6=112 B6=113
A7=113 B7=114
A8=114 B8=Out-3p-(23)

I am looking for a formula that can automatically calc (B3) to 106 (based upon cell A3) if the cell has a value of (*out*).

View 1 Replies View Related

Macro That Will Clear Contents Of Cell Based On Format Of Text In Adjacent Cell

Feb 18, 2009

Been racking brain, searching through the forum here, and my Excel 2003 Bible all day trying to figure out this problem to no avail. I would like to clear the contents of any cell in a given range if the cell immediately to the right of is formatted as bold.

View 2 Replies View Related

Macro To Insert Formula And Fill Down To Last Row?

May 21, 2014

I need a macro that will insert this formula: =Trim(IF(B3="","",MID(B3&", "&B3,FIND(" ",B3)+1,LEN(B3)+1))) into column C starting on row three through the end of the spreadsheet information.

I typed this incorrectly when I first posted. I need it to fill down into only column C not the end of the spreadsheet.

View 14 Replies View Related

Macro To Fill Down Formula As Many As There Is Data

Jun 6, 2006

Let's say I have data from column A up to column J.

Columns M, N, O contain formulas which calculate value from column J. Since this sheet is a template, the number of rows of data vary from month to month, i.e. the amount of records I copy and paste to columns A-J vary.

I would like to have a macro which will fill down the formulas in columns M, N and O as many as there is data in column J. Example: Let's say minimum number of row is 100, so up to row 100, column J already contains formulas. But if the following month the number of rows is 150, I would like the macro to automatically fill down the formulas in columns M, N and O up to row 150. But if the following month, there is only 130 rows, the macro should fill down to row 130 only.

View 4 Replies View Related

Macro To Copy Data From One Cell To Another If Adjacent Cell Meets Certain Requirements?

Feb 19, 2014

Basically I have three columns in a work Sheet F, G, & H. F is empty, G contains text and column H has both text and numbers.

I want to be able to automatically copy the value from Cell H to Cell F if cell G contains the word cost.

I would also like to delete all rows where Column G & H contain two dashes -

View 7 Replies View Related

Macro To Copy Value From Adjacent Cell?

Jul 14, 2012

Macro to find blank cells in column I , wherever it finds a blank cells , cell value in column F adjacent to blank cell gets copied in column I ......

View 3 Replies View Related

Use Value From A Cell Immediately Adjacent To Referenced Cell In A Formula

Feb 25, 2014

I need to create a cell reference which will allow me to specify a cell in a table by value (using indirect) and pull the value from a cell immediately one row over for use in a formula. Say I have a table Containing column A and B; I want to reference the value of a cell in column A (e.g. "Large Widget") and receive (in the formula) the value in column B (e.g. "41 cm^2").

View 4 Replies View Related

Text In Cell Then Formula To Put Particular Number In Adjacent Cell

Feb 16, 2014

I have text in column A of either "xxx" or "yyy"

I'm looking for a formula so that If

A1: "xxx" then B1: $100
Or if
A1: "yyy" then B1: $150

So when I write "xxx" or "yyy" in a cell of Col A

then $100 or $150 shows up in adjacent cell in Col B automatically.

I will need to sum the numbers later so Col B will need to be in number/accounting format.

View 3 Replies View Related

Formula To Keep Adjacent Cell Blank When No Date Is Added

Jan 23, 2014

I have a formula in my spreadsheet that shows dates for servicing of products. Column F show's Date Last Serviced and the adjacent column (G) then shows Date Next Service. When there is nothing on the F column's cell then the date that appears on my spreadsheet is 31/12/00. It looks messy and I would rather have a formula to make it so that if the F column is blank, then the adjacent cell in G column should stay blank also.

To automatically calculate the next service due date, I have variants of this formula that creates the dates in G column:

=DATE(YEAR(F4)+1,MONTH(F4),DAY(F4))

I tried adding as an extra part, for example:

=DATE(YEAR(F4)+1,MONTH(F4),DAY(F4))&If(F4 = 0, "", F4)

It always brings back the answer of 366, and does not make the cell blank...

View 2 Replies View Related

Macro To Fill Column With Relative Formula

Nov 21, 2007

I want my column to be populated by formula using VBA. Let's say on row1, the formula is = SUMIF(mysheet!$L:$L,$A1&C$1&"09",mysheet!$M:$M). And on row 2, the formula is
=SUMIF(mysheet!$L:$L,$A2&C$1&"09",mysheet!$M:$M). And on row 3, the formula is =SUMIF(mysheet!$L:$L,$A3&C$1&"09",mysheet!$M:$M). And this is done up to the last row. How do I do this?

View 9 Replies View Related

Add Formula & Auto Fill Via Macro Code

Mar 13, 2008

I want a Macro to be able to copy a formula down from cell A2 down the entire column within the data range. But, the problem I've got is that the spreadsheets I'll be using the Macro on will be different sizes. Currently, the VBA looks like this:

ActiveCell.FormulaR1C1 = "= LOWER(RC[3])"
Range("A2").Select
Selection.AutoFill Destination:=Range("A2:A17340"), Type:=xlFillDefault
Range("A2").Select

So the "Destination:=Range("A2:A17340")" part copies the formula into all cells from A2 to A17340. Other spreadsheets might only have data up to cell A200, or Awhatever - is there a way of getting the macro to populate just the cells in column A but only where there is data adjacent in other columns?

Also, I want the Macro to be able to delete all rows wherever "DELETE" appears in a certain column - I had a look at the "Delete Entire Row Based on Criteria" Macro but I'm looking for a fully automated solution, rather than the question boxes coming up and asking which cell/criteria, I need to run this macro on multiple sheets and the criteria/column position will always be the same -

View 7 Replies View Related

Copy/Fill Down Formula Macro Code

Jun 5, 2008

I have created a macro with the below formula in it:

Range("L2").Select
ActiveCell.FormulaR1C1 = "=LEN(RC[-1])"
Range("L2").Select
Selection.AutoFill Destination:=Range("L2:L234")
Range("L2:L234").Select

I am using column K and it looks up the length of this cell. When I created the formula I was using info that only went to line 234 which was fine. Once I clear the info in column K and input new info it can go further than line 234. How do I get the macro to look up the whole of column k without having to create a new macro each time?

View 6 Replies View Related







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