Mod Function For Comparing Looping Values

Dec 30, 2006

The following formula (thanks to Barrie) determines if the difference between 2 values equals a third value, within a fourth ‘margin of error’ value, and returns either True or False.


View 9 Replies


Nested Looping For Comparing

Mar 31, 2007

I'm working on a VBA program to find matching data which will work something like this;

ColA = DocumentTitle
ColB = Filename
ColC = ReferenceNumber

an oracle database stores a list of Documents, I have already written the code to pull the needed DB columns into excel as ColD,ColE respectively. it gets tricky here because ColA needs to find a match in ColD and then compare ColB to ColE (on the same rows as ColA and ColD) and if they match ColC's cell will change to green to show a match. Alternately Colc can be thrown into ColG as a flag... I'm not sure what is easier, color would save on cells and is all that is needed. I can think how how it should work, but I'm new to VBA programming and am having difficulty doing the full comparison the way I'd like.

View 4 Replies View Related

Comparing 2 Arrays Without Looping Through Their Individual Elements

Jul 28, 2009

how to determine if 2 arrays are identical w/o a loop. This is in order to make the comparison as quick as possible.

View 10 Replies View Related

Looping If Function Through Array?

Jan 9, 2014

I have a big macro that runs whenever there is a change made. I'm not gonna link it all because I don't think that would be useful... This macro does:

1. Disables Events.
2. Removes Protection
3.Calls some macros that check a few values and change a few cells.
4. Activates events.
5. Hides or shows ranges of cells depending on the results of the called macros.
6. Reactivates protection.

As well as the cells the called macro changes, there is a column of True/False results stretching from AE16 to AE491 with several blanks in the list as well. (All of this is decided upon a different macro that isn't linked with the change.) I want a loop that will read the True/False column and if it finds a false, make 8 buttons invisible.

I tried putting this code between Step 5 and 6 of the macro.

Dim J As Integer
J = 16


This isn't working at all... I was thinking if there was gonna be an issue then it would be the opposite where it stops the buttons appearing all together but even when there are falses and I am changing things it doesn't seem to make a difference.

View 3 Replies View Related

Selective/Looping Substraction Function

Nov 3, 2007

i have a column that has some values in it. Most values are #N/A but some are numbers. I am trying to create a function of some other snipet of code that would substract one value from the previous value and have the result next to the first value.

View 14 Replies View Related

Macro To Give Count Of Unique Values After Comparing Comma Separated Values?

Mar 2, 2014

I need a Macro (not formula) which compares the comma separated values present in Column "I" with individual values present in Column "D" and generate the count of unique values in Column "J".

The sample sheet has been attached for reference.

View 3 Replies View Related

Comparing Input Value From Set Of Values 1 And Output Data From Set Of Values 2

Sep 28, 2012

Got a road block on one of the trackers which I am trying to create which compares some of our agreements. Basically we need to compare current production with our contracts and then bring the tier level they are at in order to then calculate how much in overrides we receive. Belwo is an example:

Input Value = 140000
Out Should be = 1.5%

Set of Values 1


In a nut shell it will look for 14000 in set of values 1 and pick T3 to then go in set of values 2 and display corresponding T3 which will be 1.5% in above example as output.

View 2 Replies View Related

Macros In A Cell Function: Comparing 1 Value Against Another

Apr 29, 2006

Can I run a macro from a cell function in Excel 2003 with the idea of
comparing 1 value against another and if its true, it gets highlighted yellow?

View 14 Replies View Related

IF Function: Comparing Data From Two Columns

Jul 27, 2009

I'm comparing data from two columns like this:


and my goal is to have a TRUE or FALSE in the third column for the following criteria: TRUE if left column equals TRUE or if left column equals FALSE and right column equals TRUE. False if else........

View 5 Replies View Related

Comparing Values (to See Any Duplicated Values Using Macro) ?

Sep 14, 2008

on a sheet i have 2 column with values.

For e.g

DevID DevNum
123 s123
123 s234
987 sabc
987 sabc

Is there a way where i can compare the values in DevNum with the same DevID
to see if theres any duplicated values using macro?

View 10 Replies View Related

Getting Values While Looping A Listbox?

Jan 17, 2014

here is the code that I have come up with, Im trying to loop through a listbox having troubles getting value.

Private Sub cb_Delete_Click()
Dim peo As Worksheet: Set peo = Sheet3
lr = peo.Cells(Rows.Count, 1).End(xlUp).Row


View 1 Replies View Related

Multiple Corresponding Values (looping)

Jul 27, 2007

I'm using Excel 2003:

I have agents that want to "own" records depending on the zip code. I want to dynamically assign agent to a record based on the zip code. If there was only one agent per zip code, this could easily be done with Lookup. However, in many instances there will be multiple agents for a zip code. In these cases, I was hoping to assign the agents to each record in a round robin fashion.

My agent/zip table would may look something like this:

37011 Smith
37013 Jones
37023 Herrman
37025 Martin
37025 Slater
37025 ORiley
37028 Phelps
37028 Trenton
37029 Reagan

I would then have another sheet made up of home addresses that each have a zip-code. If the record contains zip 37013, I can easily assign that one to Jones. However, if the zip in the record is 37025, there are three agents sharing that zip. So for the first record with 37025, I would assign Martin. The next occurence of 37025 would be Slater and the third would be ORiley. The fourth occurence would go back to Martin and so on.

I have found some versions of what I want to do on this site and others but can't find the looping capability.

View 9 Replies View Related

Looping Macro: Summing Up All The Values

Sep 24, 2008

So this code works fine without any error messages but I need to add a sum feature. Any ideas on summing up all the values from the for statement into the cell that corresponds to the value of the variable t. I think i need to store the the value of the for statement as a variable and then at the end of the for statement add the next value from the for statement and so on

Dim t As Integer
Dim m As Integer
t = 7
m = 11
Do While Cells(t, 7) ""

For m = 11 To (30)
col = Split(Columns(m).Address(0, 0), ":")(1)
Cells(t, 8).Formula = "=VLOOKUP(G" & t & ",indirect(" & col & 2 & "),2,FALSE)"
m = m + 1
Next m
t = t + 1

View 9 Replies View Related

Looping Through And Cutting / Pasting Values Between Two Dates

Jun 17, 2014

I am trying to cut all rows with the date less than 2 days older than the current date. Cut and paste it into a new worksheet in same workbook and save it into a specific folder.

[Code] ....

I am getting an error on the line :

[Code] .....

Saying Object doesn't support this property or method.

View 9 Replies View Related

Newbie Looping: New Instances Of Symbol Values

Oct 24, 2008

I have a looping dilemma. I update daily stock information to a table. Column A is the symbol. There are repeats of the symbol, which is what I'm looking for to start running functions/ alerts on them based on criteria etc. Anyway. I'm trying to loop through to look for new instances of symbol values, or, values in column A. What I've tried to do so far experimentally is to get a symbol value to be counted from an input box, then find a matching value in the range. It's below, not working:

Sub NewSymbolAdd()

'This is the macro that will loop through the symbols column of the master list to see if the new data downloads are new/
'need to be set up to download daily pricing data or ignore if that sheet already exists.

Dim symb As String
Dim finalrow As Long
Dim count As Long
Dim countsymb As Long

'Find the range size.

Worksheets("Watch List Main").Activate
finalrow = Cells(Rows.count, 1).End(xlUp).Row.........

View 9 Replies View Related

Comparing 2 Values.

Nov 5, 2008

Comparing 2 values.

I need to compare the value's on 2 cells. I have a sheet setup for my sales I would like to compare each day of the week. So in other words I would like to compare this Monday with last Monday and know what the percentage of my sales ether up or down is.

Last Monday = sales $100.00
This Monday = Sales $200.00


So If sales are up I would like the percentage amount font to be in green. But if sales are down I would like the percentage amount to be in red.

View 2 Replies View Related

Looping Through Files In Multiple Folders Searching For Certain Values

May 1, 2013

I'm trying to code a macro to search through all the files in certain folders to find a value defined by the user. The rows containing that value will then be copied and pasted into a separate workbook. My boss currently planning on storing about 550 different files (90 days worth of data) between these folders, but there is the possibility of years worth of data collection, should he change his mind about the 90 days, so I'd like the code to be efficient if possible. What I've tried to do is search each file for the value, then set a range equal the first row containing that value. If the value is found in that workbook, the code loops through the worksheet, adding all the other rows with that value to the range. Then the file looping exits (the values I'm looking for are only contained in one of the workbooks) and the range is copied and pasted into the master workbook. Each workbook has only one sheet.

I'm currently getting a run-time error "13" Type Mismatch error when it gets to the line where the code is supposed to find the value and initialize the range.

Private Sub SubmitButton_Click()

Dim mybook As Workbook
Dim masterbook As Workbook
Dim rownunm As Long
Dim pathparts(1 To 5) As String

[Code] ......

View 3 Replies View Related

Comparing Cell Values?

May 28, 2014

I have a football score system and wish to compare the values of various cells - 2 if possible, but more if not possible.

Essentially I have a list of predictions for the score of a game (e.g. 2-1, 1-0, 0-0, 2-2 etc) in a spreadsheet, and I have a cell where I enter the correct scoreline (e.g. 2-1). The way the points system works is that if the prediction is correct (i.e. 2-1) then that player gets 3 points. If the result/outcome is correct but the scoreline is incorrect (i.e. 1-0) then the player gets 1 point. If they result/outcome and scoreline are incorrect, then that player gets 0 points.

Ideally I would link to compare 2 cells - predicted score and actual score, where the format of the scores is entered as 2-1.

However, I feel this may be easier having to columns for the score - Column A = 2 Column B = 1. In this way the scores only need to be compared cell by cell, however they would need to be compared by value for the correct outcomes.

View 5 Replies View Related

Comparing Values In Two Columns?

Jul 13, 2013

There are two columns A and B and values there in

1 1
2 2
3 3
4 4
9 5
10 6
11 13
15 15

As you can see there are certain numbers that are missing between column B and A. I want to know which of the numbers that are present in column B are missing in column A ...any handy calculation ?

View 3 Replies View Related

If Statement For Comparing 3 Values

Jun 25, 2014

How would I write a IF statement comparing 3 values. For example the field that it would be referencing would have values cell E51(1,2,3,4,5,6,7,...99). The pull back would be:

1-10 = $250,000
11-15 = $550,000
16+ = $750,000

View 2 Replies View Related

Comparing With Key Values In 2 Workbooks

Dec 13, 2005

I work for a financial firm. Every morning I compare today's cash balance file (sent from our custodian) with yesterday's to see if there is anything different in each portfolio cash balance column. Right now I'm doing it manually checking row by row. It'll become tedious if more and more portfolios are added. I'm looking for an efficient way I can use the portfolio codes column (as a key) to compare with previous day's file’s portfolio codes column , and list only those portfolios(in another workbook) if the corresponding cash balance column doesn't match. This is what I started doing:

Private Sub compare_cash_bttn_Click()

Dim b1 As Workbook, b2 As Workbook, b3 As Workbook

Dim w1 As Worksheet, w2 As Worksheet, w3 As Worksheet

Dim i As Integer

i = 2

Set b1 = Workbooks("CashA")

Set b2 = Workbooks("CashB")

'Set b3 = ActiveWorkbook

Set w1 = b1.Sheets(qry4rCash).........................

View 9 Replies View Related

Comparing Values And Returning Different Column

May 31, 2007

I want to return the proper value from sheet 2 into column C in sheet one. I have the current formula set up as an array but I only get the value that matches the first row in Sheet 2.

HTML Column A Column B Column C
Date Number Who
3/23/2007 902-555-2596=IF($B2=Sheet2!$A$2:$A$2001,Sheet2!$B$2:$B$2001,)
3/23/2007 980-123-6621=IF($B2=Sheet2!$A$2:$A$2001,Sheet2!$B$2:$B$2001,)
3/23/2007 980-123-6621=IF($B2=Sheet2!$A$2:$A$2001,Sheet2!$B$2:$B$2001,)
3/23/2007 980-555-6621=IF($B2=Sheet2!$A$2:$A$2001,Sheet2!$B$2:$B$2001,)
3/23/2007 980-678-0352=IF($B2=Sheet2!$A$2:$A$2001,Sheet2!$B$2:$B$2001,)
3/23/2007 902-555-7958=IF($B2=Sheet2!$A$2:$A$2001,Sheet2!$B$2:$B$2001,)
3/23/2007 980-555-6621=IF($B2=Sheet2!$A$2:$A$2001,Sheet2!$B$2:$B$2001,)
3/23/2007 980-555-6621=IF($B2=Sheet2!$A$2:$A$2001,Sheet2!$B$2:$B$2001,)
3/23/2007 902-555-7958=IF($B2=Sheet2!$A$2:$A$2001,Sheet2!$B$2:$B$2001,)
3/23/2007 902-555-7958=IF($B2=Sheet2!$A$2:$A$2001,Sheet2!$B$2:$B$2001,)
~~~~~~~~~~~ Sheet 2 ~~~~~~~~~~~~~~~~~
Column A Column B
902-555-7958Big Bird
902-555-5100Daffy Duck
902-555-5752Donald Duck

View 12 Replies View Related

Comparing Columns For Values Greater Than Each Other

Apr 27, 2009

I have two columns A and B. I need a count of how many times a value in B is greater than the same row in A. I don't want to insert a new column (e.g. for if statements to add up).

Can I insert a countif at the top to do that? I tried various countif variations but could not find the right one. Additionally any other option that does not involve adding new columns/rows.

View 5 Replies View Related

Comparing Previous Values Of A Cell

Nov 4, 2009

I have a cell (F2) that is auto updated with total sales units for today (Its a simple counter of individual sales). I want to detect when there is a "batch" of sales >= 10. ie. F2 may start at zero for the day and increment by 1,2,5 or 10 units at a time. If the increment is 10 units or more I would like to detect this and store the result in cell G4.

Typical values in C2: 0, 1, 6, 7, 9, 19, 21, 22 etc as new orders arrive. The larger order between 9-19 (viz 10 or more), I need to detect and store in G4. I know that I need to use both the current value of F2 (say 19) and the previous value of F2 (say 9) to perform this, but the solution eludes me.

View 2 Replies View Related

Comparing And Copying Values Between Dates

Feb 19, 2010

I’m attempting to find values that are within a band of .001 of the values of cells in columns L through O and searching columns B through I for values that meet the .001 criteria and copying the values to columns Q, R, S, and T respectively.

I mentioned the values in L, M, N and O are where the comparisons will be made and these values are tagged to a specific date in Column K. I need to find the dates in Column A that are in between the values of K and the cell beneath it. For example, in K4 I have a date of 10/3/99 and the next date I have in K5 is 10/5/99. I would then query Column A for the dates 10/06/99 (A4), 10/07/99 (A5), and 10/08/99 (A6). The values I need to find within the .001 band are in Columns B through I (B4:I6). Lastly, when reach the last value in Column K, query all values in Column A greater than last value in K and copy the appropriate values in B through I to Q through T.

Rules for copying data to Column Q, R, S, and T:

For Column Q-
Find values in B, C, or D that’s within plus or minus .001 of M and copy the value of B, C, or D into Column Q of the same row.

For Column R-.................

View 5 Replies View Related

Macro - Comparing Values In One Column

Nov 13, 2009

I'll try my best to explain what I'm trying to do here using Excel macro (i've very limited knoledge in VBA ). I am working on a project where I'm using an actuator to measure micro-switches. The values are then extracted using HyperTerminal via RS232 and transferred to Excel to filter the values and display only the ones that are important.

Here is what I'd like to do via a Macro:

Compare cells in column A (e.g A1 and A2, A2 and A3, A3 and A4 etc.)




So first, if the values increase, do nothing and keep comparing other values. If we find the values decrease, display the larger value between the two, in this case it's the value 2200 that we want to display.

Next, the values will be decreasing progressively. We'll do the comparison between 2 values but this time if the values decrease, do nothing until we find a value increases. Display then the smaller value between the 2, here it's 1500.!

View 9 Replies View Related

Macro: Comparing Values In One Column

Nov 13, 2009

I'm trying to do here using Excel macro (i've very limited knoledge in VBA ). I am working on a project where I'm using an actuator to measure micro-switches. The values are then extracted using HyperTerminal via RS232 and transferred to Excel to filter the values and display only the ones that are important.

Here is what I'd like to do via a Macro:
Compare cells in column A (e.g A1 and A2, A2 and A3, A3 and A4 etc.)


So first, if the values increase, do nothing and keep comparing other values. If we find the values decrease, display the larger value between the two, in this case it's the value 2200 that we want to display.

Next, the values will be decreasing progressively. We'll do the comparison between 2 values but this time if the values decrease, do nothing until we find a value increases. Display then the smaller value between the 2, here it's 1500.

View 9 Replies View Related

Comparing Cell Values In Two Worksheets

May 11, 2007

I am aware this question must have been asked to death on this forum and I already searched and found some answers but for some reason I can´t get it to work. I have two worksheets (sheet1 and sheet2). In Column E of Sheet1 I have product descriptions that I want to compare cell by cell to the product descriptions in Column F of Sheet 2. If they are not the same, color in the cell in Sheet 2. There are 1810 rows in both columns. I tried this method but it gives me an error (in spanish) that says that I cannot compare ranges of data.

I have also seen some code to do something similar ( ):

Sub find_cell()
Range("A:E"). Find(What:=Cells(2, 6).Value, LookAt:=xlPart).Activate
ar = ActiveCell.Row
ac = ActiveCell.Column
' the two lines above store the row and column values of the cell found
' in your example ar is going to be equal to 229 and ac is 3
' now this following lines are to change the colors to red
With Cells(ar, ac).Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End Sub

I don´t quite get the "Range("A:E").Find(What:=Cells(2, 6).Value, LookAt:=xlPart).Activate" part though.

View 7 Replies View Related

Hiding Particular Rows By Comparing Values In Array?

Mar 25, 2013

I need to hide the rows in an excel whose value is equal to the array list that has been already hardcoded...How to do this...

View 1 Replies View Related

Comparing Two Columns Of Data And Returning Values That Do NOT Appear In Both

Apr 22, 2014

I have an attendance sheet that employees scan their badge number, and returns their name and time/date stamp using a simple VLOOKUP.

I want to create a report that compares the names in the attendance sheet against the all the names in the master sheet, and only returns the names that have not attended the training.

I have tried a few test formulas using COUNTIF function, but with no luck.

I have attached an example. Use the worksheet labeled April 2014 A (2nd shift)

New Six Point Safety with Attendance Sheet Barcode Scanning.xlsx‎

View 3 Replies View Related

Copyrights 2005-15, All rights reserved