Check Each Cell In Range For Value & Put Text In Offset Cell

Jun 7, 2008

I'm trying to look at a value in one column (Column A) and if it matches a set of criteria, I'm trying to change the value of another cell 6 columns to the right.(Column G) I've been trying for a couple of days now to get this working, but to no avail. I've tried to modify the code below that I've found on this site but can't quite figure out what I'm doing wrong.

Sub RatingsFix1SP()
Dim FindWhat, rngCell As Range, i As Integer
FindWhat = Array("BB", "B", "CCC", "CC", "C", "CCC+")
For i = 0 To 3
For Each rngCell In Range("A2", Range("A" & Rows.Count).End(xlUp))
If InStr(rngCell, FindWhat(i)) <> 0 Then
rngCell.Offset(0, 6) = 0.15
End If
Next rngCell
Next i
End Sub

To try to clarify a bit: If column A in the attached spreadsheet has a rating code of BB, B, CCC, CC, C, or CCC+, I want the Haircut % rate in column G to be 15%. It seems the code that I'm using changes the % rate to 15% if any "B" or "C" shows up in any part of the string in column A.

View 5 Replies


Find Last Cell In Range, And Changing Another Cell Based On Offset Text

May 4, 2009

If i have a range say E12:O12 and want to find the last cell before blank, lets say it finds m12 as the cell with the value before blank. then with m12 it needs to determine weather row 11 in the same column has Text either "S" or "F" if "S" then m12 = t if "F" then m12 offset(1,-1) = t. And just to make things more difficult i need the range E12:O12 to step 2 as well until it gets to E208:O208 .Noting that row 11 never changes and will always have either an "S" Or an "F"

and also t = time()

View 7 Replies View Related

Find All Instances Of Cell In Column & Check Offset Cell

May 21, 2008

how to explain this except by showing it, so I explained it as best I could in the attachment. Anyone think they have a solution for this? Let me know if you need more information. Thanks!

the macro will look at the value I entered in cell A1, then find all instances of it in Column A
in every row that A1 matches, if the value in column E is "0", I need the macro to change the value in column E of that row from "0" to (that row's column B * $B$1)

View 7 Replies View Related

Macro To Find A Cell Containing Text /select Range Offset / Cut And Paste To Lower Rows?

Feb 4, 2014

I am trying to find a macro that can search a sheet for any cell that contains the text "Not on AOI" selects a range that contains that cell, 81 rows below, and 2000 columns to the right, then cuts the selection and pastes it 162 rows below the original cell where the text was found. What's hard is that the number of columns between the "Not on AOI" cells is variable.

I'm very new to excel macros and the parts I think I've put together are:

Cells.Find("Not on AOI", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=True).Activate


View 1 Replies View Related

Check If Text A In Cell Occurs In Alphabet To Extract Its Range From A-G / H-N

Mar 15, 2013

I am trying to categorize a list of words based on the first letter.

For example:

[Code] ......

I want to see if the letter 'D' in 'Data' occurs in a range from A-G, if so display "A-G" in cell B,
else if the first letter occurs from H-M, display H-N in cell B
else if the first letter occurs from N-R, display N-R in cell B
else display S-Z in cell B.

View 2 Replies View Related

Excel 2013 :: Check Cell For Text And Return Corresponding Text In Adjacent Cell?

Jan 28, 2014

I have 2 tabs in a 2013 workbook. Inventory Receipts and lookups. One of the Data verification lookups I have is a drop down list in each cell in Column B (eg: Cat, Dog, Mouse) In the lookups tab I have another cell range containing the sounds (eg: Meow, Bark, Squeak).

What I am trying to acheive is, if B2 contains Cat, then return Meow in B3, if B2 contains Dog then return bark in b3 and if B2 contains Mouse return squeak in B3. Ideally I would like the formula to return the text from my lookup sheet (eg: 'Lookups'!C2,'Lookups'!C3,'Lookups'!C4). So depending on which option they choose from my animal drop down list .. the correct noise would automatically fill in.

View 9 Replies View Related

VBA - Find Cell Containing Text And Use An Offset Cell Value In Formula

Feb 13, 2014

I'm trying to do a column of individual discount calculations using a discount percentage found in a cell two to the right of a cell containing the text "Total SP:" that is always upwards and to the left of the cell where the formula goes (but could be two rows or could be 20). There are multiple "Total SP:" cells in the sheet - I always want the first one upwards. I have created the following but I get #NAME? where I hope to see the discounted value.


Dim Discount1 As Double
Discount = Cells.Find(What:="Total SP:", After:=ActiveCell, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=True).Offset(0, 2)
Range("R9:R" & LastRow).Formula = "=IF(J9>0,$E9*(1-Discount1),0)"

I've just thought, the Cells.Find needs to be redone for each cell where the formula is inserted to ensure it always catches the correct discount and this isn't going to do that - it's going to find it once and always use that single value.

I think this needs a Loop or something and to move the ActiveCell down one after the formula to get it to redo the Cells.Find.

View 1 Replies View Related

Offset Cell To Populate The Text Box

Mar 11, 2008

How can I make this statement take the value from the Offset cell to populate the text box and not take the value from the text box to popluate the Offset Cell?

With txtBoarded
ActiveCell.Offset(0, 1) = .Value
End With
This code is in the user form initialize code.

View 9 Replies View Related

Offset Function - Get Text Form Cell

Nov 22, 2013

I have this offset function working:


The cell name "5260", is also entered as text in cell A1, in the current workbook (not calculos.xlsx). How do I refer excel to get the text from cell A1, instead of having to enter it manually.

View 3 Replies View Related

Offset For Specific Cell Range(s)

Dec 18, 2008

I am designing a form that tracks call times. I have a control "cmdStart" that when clicked will enter the "Start" time in cell A4 and each time clicked will skip a column and enter the next time in cell C4. The same for a control "cmdEnd" that will enter the "End" time in cell B4 when clicked. Then the next end time clicked will go in cell D4. However, when the Start time enters the time in AE4 I need the next start time to start in A6 and do the same in this row until AE6 and then drop down again. The same with the "End" time when it reaches AF6. I think I could write the If and Else for each individual cell, but there must be a more efficient way to do this.

View 4 Replies View Related

Lookup Value In Range Then Average Offset From That Cell

Mar 10, 2014

I have 2 columns of data (col A is time, col B is a value), in a range A4:B1000 (can be less, but the biggest the range will get is to B1000). Example:

A / B
4 10:37:55 / 91
5 10:37:56 / 92
6 10:37:57 / 93
7 10:37:58 / 100
8 10:37:59 / 105
9 10:38:00 / 110
10 10:38:01 / 111
11 10:38:02 / 115
12 10:38:03 / 120

Im looking for a way in VBA to look for a time entered in cell C1 (example 10:38:00), find that in column A, then return the average of values in column B that are offset 271 - 300 rows. This is entered in D1. So in my example, 10:38:00 is in cell A9, return the average of B280:B310.

View 3 Replies View Related

Offset Cell From Found Maximum In Range

Feb 20, 2008

I recently asked how to locate a max value within a variable range using a macro and got the following responses: Get Maximum Value From Graph / Chart, all of which worked great.

Dim r As Range
Set r = Range("D2", Range("D50"))
Range("K1").Value = Application.WorksheetFunction.Max(r)

Range("Max1") = Application.WorksheetFunction.Max(ActiveChart.SeriesCollection(1).Values)
Start = "D24"
Finish = "D163"

Range(Start, Finish).Select
myrange = Selection.Address
Range("Max2") = Application.WorksheetFunction.Max(Selection)

Now I would like for a different cell to return the time value located one column to the left of the max value found above. I've tried to adapt other offset formulas that I've found to my purposes and haven't been able to make it work. how to do that using the max value as it is found in any of the above three ways

View 4 Replies View Related

VBA Copy Offset Cells To Another Worksheet If Cell In Column B Contains (text)

Feb 13, 2014

I want to do the following:

If cells in column B from Sheet 1 contains ''text'',

Copy Cells from column D and F from Sheet 1 - TO - Sheet 2 in columns C and E -

View 1 Replies View Related

VBA - Copy Range Of Cells And Paste If Offset Cell Not Blank

May 23, 2012

What can I add to the macro I already have in place (below) to accomplish what I'm looking for (2 parts)? ...

1) I need to copy everything (formulas) that is in C7:F7 and paste it down to all "active" rows - I'm defining an active row by any row where column A is not blank.

2) I need to copy everything (formulas) that is in Q7:AF7 and paste it down to all "active" rows - I'm defining an active row by any row where column P is not blank. (You'll notice by the screenshot that there will be blank cells in column P mixed in with non-blank cells.)

Sub AdminTool()
' CreateAdminTool Macro

ActiveWindow.Zoom = 90
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

[Code] ...........

View 7 Replies View Related

Add VLOOKUP To Cell (Macro Code) & Offset From Range For Lookup Value

May 27, 2008

I'm trying to use an offset from a Named Range as my source cell in a vlookup but get a -1004 Object not defined error. When Debugged the Range.Formula appears to be blank when queried. Using Record a Macro the Reference to a named range worked fine but I could not test for an offset or the use of the range reference. What can I do to use to make this work


View 7 Replies View Related

Check If Text String In Cell With Other Text Is In List

Mar 27, 2008

I have a sheet in which some of the cells have two strings separated by a linefeed. I have come up with a cumbersome formula which will let me check if either of the two strings is a member of a list stored on another sheet. However, it fails if there is only one string in the cell, presumably as there is no linefeed for the formula to find. How can I modify the formula to cope with this situation?

There are also on occasions, three strings in the cell, but I can't seem to access the middle string with the formula. Simplified spreadsheet attached to show the problem. This must be formula-based, as we have a no VBA policy. If you think there is better way of doing this, please let me know.

View 3 Replies View Related

Check If Cell Contains Text

Jan 1, 2010

For all bank transactions I've downloaded, I would like to add a subject. The list contains many hundreds of rows, so I tried to make a macro for it. Unfortunately I cannot manage to search if a cell contains a certain text string. I came up to:

View 14 Replies View Related

Check If Text Is In Another Cell

Jan 2, 2010

I'm trying to identify if text contained in one cell is also contained in another cell. I used the following formula with some success, but it is not successful in all situations, and I don't know why.


Attached is a spreadsheet with the example.

View 4 Replies View Related

If Text Of Cell In Range Matches Text Of Cell In Column - Match Formatting

Jul 5, 2012

Trying to create a button that, once clicked performs the following task:

Checks whether the text in a cell in the column X2:X40 matches the text in a cell in the Range A2:U14.

If it does, the formatting of the cell in X2:X40 (eg background) must change to match that of the corresponding cell in A2:U14.

Only 1 cell in the range will match 1 cell in the column

For example:
Before click:
Cell A9 has "John" written in it and a yellow background
Cell X4 has "John" written in it and a clear background

During click:
matches these cells
changes X4 so that it also has a yellow background

After click:
Cell A9 has "John" written in it and a yellow background
Cell X4 has "John" written in it and a yellow background

View 3 Replies View Related

Excel 2010 :: Dynamic Range - Cell References Changing In OFFSET Function

Apr 12, 2012

I'm working in Excel 2010. I'm trying to create a dynamic range, using the OFFSET function. I've got it working beautifully but as soon as I save it and close the Name Manager the range stops working. When I go back into Name Manager I find all the cell references have changed (from C1:C600 to C1048572:C595 - or some other strange range).

P.S. What it's doing isn't so important as when the cell references are right it works. But just for full info: It's an OFFSET function, starting at A1. It will look at a list of companies and use a Match function to find out how many rows to offset (based on where the first instance of a particular company. And it uses the COUNTIF to make the range the same number of rows as there are entries for that company.

Here is my broken function:

=OFFSET('Map Point'!A1048572,MATCH("Company Name",'Sheet Name'!C1048572:C595)-COUNTIF('Sheet Name'!C1048572:C595,"Company Name"),0,COUNTIF('Sheet Name'!C1048572:C595,"Company Name"))

View 3 Replies View Related

Check If Cell Has Numbers Or Text

Aug 6, 2008

I'm having a hard time figuring out a solution for this situation. By the way I'm working in VBA macros. I need to check a cell for two things: if its empty or if it has something besides numbers in it. I know how to code the rest of what I need, but I'm just stuck on identifying if the cell has something else besides numbers inside it.

Possible entries would be "Isn't an enhancement" or "NOT A SIR", but I can't be sure those are the only things so I just generally need to check if there are any letters in that cell or not. One thing to note is that the contents of the cells are in text format and not number (the cell has a little green arrow in the top left that tells me about it). Any help would be appreciated, thanks in advance! Oh, just remembered, the number has to be 5 numbers long so I thought of using the Len() function but that doesn't cover things that are words under 5 letters like "None".

View 4 Replies View Related

Using OFFSET Function To Return The Value From Another Cell With Row And Column Offset

May 31, 2014

I am having some difficulties using a combination of IF and the OFFSET function to display a range of cell values from another column based on a simple condition. The values I need to display at the destination cells should be offset by 8 columns to the right and "X" rows down from the reference column. The value "X" is to be determined via the IF function to check for the row index number.

For example, if Index value "X" = 8, then display the value of B2 in cell I9. IF X = "9", display B2 in cell I10 etc.

I have attached a sample worksheet that provides some examples.

View 3 Replies View Related

Check If Cell Value Exists In A Range

May 14, 2012

If the data entered in Column "I" starting from row4, exists in range "X4:X12" then "Pend for audit" should appear in Column "R" of the corresponding row.

below is the coding Iam using.


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim StateName As String
Dim CName As String
Set Cells_Changed = Target(1, 1)


View 1 Replies View Related

Check If Cell Contains Text Copy Number To New Column?

Jul 13, 2014


if a1 = aaa then copy a1 to b1 until the cell =bbb

if a5= bbb then copy a5 to c1 until the cell =ccc

if a8= ccc then copy a8 to d1 until the cell = ddd.........

View 1 Replies View Related

Check If Any Cell In Range Contains Value And Copy That Value To Another Workbook?

Jun 9, 2014

I have 400 source files containing (among others) 8 sheets with daily results: "Fri 23", "Mon 26", "Tue 27", "Wed 28", "Thu 29", "Fri 30", "Sat 31 (if applicable)", "Mon 2".

Each sheet contains also:
State - D1
Role - D2
Staff ID - D3
Date - D4

Activity group name in column A (starting from row 8)
Activity type in column B (merged with C and D) (starting from row 8)
Activity time in columns E:GV (starting from row 8). Usually, there is none or only one value in whole range (e.g. E8:GV8). But sometimes there are two values.

Customer ID in row 6 (value appears only if time was reported in E:GV range)
CC Number in row 7 (value appears only if time was reported in E:GV range)

It's all about transferring values from all daily sheets in all files (.xls) sitting in folder C:WADFinal to one simple table (WAD_Consolidation_file.xls, sheet "Consolidated") consisted of 9 columns: Staff ID, Role, State, Date, Activity Group, Activity Type, Minutes, Customer ID, CC Number.

View 1 Replies View Related

How To Check If Previous Active Cell Was Within Range

Jun 18, 2014

So the constraints are

1. if there's a value in name or names count => must be at least one value in test1 or test2

2. last value in names count must be equal to the sum of trues in B1:B4 Problem Is it possible to identify once any of the cells in A9:D12 are activated that once that range is deactivated I run the check to make sure the constraints are met, and populate default values in the case they are not?

Is it possible to identify once any of the cells in A9:D12 are activated that once that range is deactivated I run the check to make sure the constraints are met, and populate default values in the case they are not?

Trying to figure it out with a some combination of: checking if the last cell I was in was in the range and I am no longer in that range; using the selection change change event?


Attached File : HelpMeWorkbook.xlsx‎

View 8 Replies View Related

Check To See If Cell Address Is Within Columns Of A Range

Nov 12, 2013

I have a named range BGl (G1:R1). I would like to see if a cell address ($U$6) is within the columns of that range. I need a function to give me a true or false based on changing cell addresses.

View 5 Replies View Related

Check If Text Typed In Cell Is Repeated In Row, Discounting Spaces

May 18, 2007

is there a formula which can locate instances of same text even though due to spaces it may look different? for example, "bad apple" and "badapple" are essentially the same.

View 2 Replies View Related

If Cell Contains Text - Copy Text From Another Cell Over A Range Of Cells

May 22, 2014

I have a list of text quotes in column A. I then have column B which will have a Y entered if the quote is used in a presentation. I currently have around 100 quotes.

On a separate sheet, I want to be able to effectively say in one cell - If column B has text in it, copy the quote from column A. But the difficult part is how do I make this happen so that I can have multiple quotes being pulled into one cell?

View 11 Replies View Related

Partial String Check In Cell Against Range For Return

Feb 15, 2010

I've posted this query before, not on this forum, but I don't think the replies I've had so far are going to do what I want. Initially I was looking for a formula, but the suggested pile of nested IFs won't work for the number of conditions. I saw a previous post on here for a VBA macro to search for a text value in a cell against the cell contents of a range and it seemed to do at least the first part of what I wanted. I attempted to manipulate it a little to test its applicability for my own nefarious purposes but for the life of me I can't get it working.

This is complicated by the fact that the actual data is commercially confidential, so I can't show you the actual file, but I can fake what I want with two simpler ones. I've attached them to this post. What I want is a fair bit more complex than the other post I found - I want to be able to compare a partial text string from a given cell in a range ('Check Value' in the attached TestBook2 ) against the strings in a range of cells ('Value 1' in TestBook1), and return the corresponding value from 'Test Value' to the corresponding adjacent cell to the tested 'Check Value', with an order of precedence, for example...

Testbook2 contains an entry in C5 of 'a, e, h, z, x, y'. Testbook1 shows that the return for a, b, c, or d is 'moo', for e, f, or g is 'steve' and for g through q is 'fred', all others being no returned value. Moo>steve>fred, so I want the corresponding 'moo, steve. fred or <blank>' cell to contain 'moo'. Conversely, C6 contains 't, u, z' and therefore shouldn't have a value in 'moo, steve, fred or <blank>'. C12 contains 'f, z, s, y, u' and C15 'i, x, z, s', and therefore should display 'steve' and 'fred' respectively.

View 3 Replies View Related

Copyrights 2005-15, All rights reserved