# VBA Index Match Function With Errors

Sep 29, 2013
I'm trying to replicate the iferror index match function from excel into vba. The excel version is

=IFERROR(INDEX('billing-data'!B:C,MATCH(C2,'billing-data'!C:C,0)+0,1),"")

Which works fine. In vba I have:

Cells(i, 19) = Application.WorksheetFunction. _

Index(Sheets("billing-data").Range("B:B"), _

Application.WorksheetFunction.Match(Sheets("payment-data").Range("c" & i), _

Sheets("billing-data").Range("C:C"), 0), 1)

There are some mismatches and I get an error message with this which prevents the all the data from being displayed.

I'd like to show Cells(i, 19) as null or blank if there is a mismatch or error.

View 3 Replies
ADVERTISEMENT
Aug 5, 2014

I am trying to use some vba match function code to return the column number of the matching date. The date will be stored in a date variable.

Every time I run this code I normally get a match error even though the date is in the worksheet and the variable matches that date.

See below:

[Code] .....

View 5 Replies
View Related
Oct 8, 2009

I am trying to match data from 2 independent sets, formatted slightly differently so not sure which function would work best for me. From the attached file, I am trying to match the date and time stamp (in cell A1) with that from the other data (in this example in cell E1) and return the data (from cell F1) to cell C1. So basically any date and time stamp before 04/03/09 04:00 will return a value of 44 (this value should appear, therefore in cells C1 - C30)

View 2 Replies
View Related
Aug 28, 2012

Basically where the columns say 2011 or 2012 AND 1, 2, 3. I want to be able to have it index the number below based on the GL number on the left and both the year and period on the top. I think that you can do with using the sumproduct function with the binary, but the computer is a little dated and it takes a while to run those calculations.

2011

2011

2011

2012

2012

2012

[code].....

View 5 Replies
View Related
Mar 20, 2009

Another interesting dilemma to solve. Using this formula:

View 2 Replies
View Related
Dec 3, 2013

let me start by saying that I know an example workbook would be useful here, but the part I'm struggling with is the [managementroster.xlsm] file, and there is A. no way I can release it to the internets and B. its so huge/complicated I couldn't even begin to reproduce a portion of it, scrubbed of data, and hope to maintain its functionality in a meaningful manner.

[Code]....

This formula checks a staff number on this spreadsheet, and then goes and looks at the staff number on the roster. Once found, it returns that staff members roster, but changes any manager codes in the MRC list to Mgr, and changes all other roster codes to Free.

I now need this formula, before altering roster codes to Mgr or Free, to only return codes that are a match for another table (or after really. I don't particularly care, so long as only codes are shown that match data from another table). I think an index/match function would do the trick, but this forumula is already at the edge of my excel ability, nesting another function within it is completey beyond me. The relevant cells for the index/match function would be:

This first Match function targets the column. $E3 is the date required, $BA$1:$DN$1 is the range the dates are entered in

Match: Lookup value = $E3

Lookup array = '[ManagementRoster.xlsm]Vacancies!'$BA$1:$DN$1

match type = 0

This second Match function targets the row. $A$4 is the department name, $B$434:$B$452 is the range where all departments are entered

Match: Lookup value = $A$4

Lookup Array = '[ManagementRoster.xlsm]Vacancies!'$B$434:$B$452

match type = 0

Index: array = $BA$434:$DN$452

So I think my final function is

[Code] .....

But I have absolutely NO idea where it would fit within my first formula, or how to code it so that my original formula only reproduces results that are found in both sheets, or anything.

View 2 Replies
View Related
Mar 24, 2013

I've been working on a payroll program for my small biz. I'm close to done BUT...When I use the Index Match function in a cell it works great. However I need to copy it down a column to work for pay periods going forward. When I copy it down of course it puts zeros or N/A.

Columns:

Gross Fed FICA Medicare State Net

F G H I J K

Gross is user input. FICA Medicare State and Net are simply calculated on the sheet. But to get Fed Income tax I use the Index Match function and it works perfectly. The rows increment properly with each new user input.

My question: Fed Income tax is dependent on what the Gross is in order to look up the tables with the Index Match function. How do I get the result of the function into column G? Can I increment up Column G and ignore the zeros that dragging the function down G creates?

View 1 Replies
View Related
Feb 27, 2014

I would like to have an Index & match function in my userform.

I know that i must use it like this Application.WorksheetFunction but i am not able to do it.

User select a code and then in next text boxes, description and price should appear.

View 6 Replies
View Related
Mar 31, 2012

I have different worksheets to contains information from different years. To make it comphrensve, I have created a mastersheet which contains all the info across the worksheets. And once I make an entry in the worksheet, I hope the mastersheet can be updated automatically. the function I set is

INDEX('2011-12'!K$4:K$7,MATCH(Master!$B5,'2011-12'!$B$4:$B$7,0),1).

Yet, my problem is..... once I perform sorting in the mastersheet, the cells are wrongly matched. So, I just wonder how I can revise the function?

View 2 Replies
View Related
Sep 27, 2012

I am trying to use index & match function to extract data from data base with has multiple critera in rows as well as cloumns but it is not giving correct results.

Example:

A

B

C

D

E

[Code].....

In C9 I typed =INDEX($B$2:$E$6,MATCH($A9,$B$1:$E$1,0),MATCH($B9,$A$2:$A$6,0))

The result I got was #Ref!

what formula should I use in C9 to get 20, C10 to get 5 & so on

FB1 to FB4 are column headers (critera)

GL 1 to GL5 are row headers (critera)

View 2 Replies
View Related
Apr 5, 2013

I have two worksheets, named as follows:

Worksheet1: SUMMARY

Worksheet2: ART 2013

'ART 2013' contains a list of staff numbers in column C16:C752 and a list of dates in column M16:M752 (formatted as "mm-yyyy")

Within 'SUMMARY' cell G12 contains the date 04-2013.

What I would like to do is achieve a function that will look at 'ART 2013' columns C and M in and where the date in Column M is equal to cell G12 (04-2013) of the 'SUMMARY' worksheet excel will return the Staff Number in 'ART 2013' column C.

View 7 Replies
View Related
Aug 18, 2014

I have attached a workbook.

I have a calculated value in H2. This value will correspond to values in the table provided. This value is dynamic and will change based on criteria that will be added.

The value H2 is a combination of to "letters" D1 and A2 or A4 and B1 i.e. trace back where the intersection of H2 occurs within the table

In Cells A8 and A9 I am trying to represent which combination of letters will result in an intersection of the value H2. In the example provided it is C and A.

What i would like to do is have Cells A8 and A9 be more dynamic. So if for example the value in H2 changed to say R12,06 then the intersection would be B and B. Therefore Cell A8 = B and Cell A9 = B

The formula is cell A8 and A9 doesn't cater for this as the range is fixed. I need a dynamic range for the index and match function based on the where the intersection of H2 happens to be in the table.

View 4 Replies
View Related
Apr 8, 2009

I'm matching ISO country codes to country names.

This works great as long as the 'lookup_value' portion of the match fuction matches the 3 digit code on Sheet3.

Is it possible to return my desired result without this matching perfectly.

So a value in 'Sheet1 Column A' that begins A344xxxxxxx will return the same result in 'Sheet1 Column F' as if 'Column A' just had a 3 digit number.

View 2 Replies
View Related
Dec 15, 2009

In cell G51 of sheet "My Overview", if two people have the same scores it pulls through one person twice in F51 and F52, how can i overcome this?

View 4 Replies
View Related
Jan 20, 2010

Solution for all: {=SUMPRODUCT(SUMIF(Sheet1!$A$2:$A$16,$F$34:$F$40,INDEX(Sheet1!$B$2:$K$16,0,MATCH(T$10,Sheet1!$B$1:$K $1,0))),U34:U40)}

Say I have an Excel workbook with two sheets: Employee Hours and Employee Wages. On the Hours sheet I have 31 columns (Jan1 - Jan31) with inputs for the number of hours worked by each employee by day. On the Wages sheet I have listed the same 31 columns with their wages each day (I do this to factor in wage increases that occur fairly often).

My goal is to use an INDEX/MATCH function to calculate the total daily compensation for each day on the Wages sheet by multiplying hours*wages for all employees that day. Here's the code I'm using:

View 2 Replies
View Related
Feb 9, 2010

We're selling language courses that have a different price depending on when a course is taken. We're trying to build a price quote application that needs to look up a certain school and course and price driven by a start date.

How can I build a lookup function that says: pick the price of school X and course Y when the start date falls between dd/mm/yyyy and dd/mm/yyyy?

I manage to build a look up function with MATCH and INDEX when the condition of start date is exactly matched but dont know how to instruct it to match a value between a start and end date.

View 14 Replies
View Related
Oct 24, 2008

I have a project that has several worksheets of "summarized" data all pulled from one worksheet. The data worksheet is run through an external program and pasted into the workbook to update the information.

To this point I have used tons of index match array formula's to pull the information but I've found this to be extremely inefficient because there are hundreds if not thousands of formulas, and it takes several minutes to update. The file is also around 3MB which is way too big.

I was thinking about using VBA to simplify the worksheets, but then I came across an article about D_Functions and I'm thinking they may be the solution to my problems.

However there is one catch...I'm not sure how I would build these formulas to work in my worksheets. I understand the principle behind the D_Functions, but I can't seem to grasp the concept of integration and making it work in my scenario.

I've attached an example of this workbook, it has most of the forumla's deleted out to reduce the file size, but it should give you an idea of what I'm doing. Once you open it you'll have to unhide some columns to get to the nitty gritty of the sheet.

Feel free to take a gander...I'm open to any suggestions you may have at this point (except to trash the whole project hehehehe ). If you find a solution please explain the concept behind it. I really want to learn how to make this work rather than plugging in someone elses formulas.

View 10 Replies
View Related
Mar 17, 2013

How do I translate this to a vba code?

=INDEX('Workers List'!D3:D13,MATCH('Workers List'!C4,'Workers List'!C3:C13,0),1)

what i have done is

test = Application.Index(Sheets("Workers List").Range("C3;C13"), Application.Match(1, Sheets("Workers List").Range("D3:D13"), 0), 1)

But i keep getting an error, may i know whats wrong with it?

View 5 Replies
View Related
Jul 30, 2014

Here is the table I am working with

Date

Open

High

Low

Close

Volume

Adj Close

Semi-Annual Yield

Theoretical Bond Price

Index

Coupon

Total Value

Peaks

Troughs

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

The Relevant columns would be "Date" column A cell 1, "Total Value" column L cell 1, "Peaks" column M cell 1, and "Troughs" column N cell 1. What I basically want to do, in the next column, column O, is this: If cell N# = "Trough" find the previous M cell = "Peak" and take the L cell in that "Peak" row and subtract the L cell in the Trough row from it (like =(L4-L9)/L4)). Then in column P, if the percentage drop was 5% or greater, I want to find the days between the trough we are looking at, in cell n10, and the NEXT Peak, cell M11, using the corresponding dates in Column A.

View 3 Replies
View Related
Nov 11, 2009

I have this equation

=(INDEX(abc!B8:D18,MATCH(Sheet1!C39,abc!A8:A18),MATCH(Sheet1!D39,percentiles,0)))

it gives me this #N/A. I'd rather have it show $0.00.

View 9 Replies
View Related
Sep 29, 2012

I am currently using the Match and index functions to search for specific criteria and return specific data based on that criteria. The problem is the formula is returning the first value at the beginning of the month rather then the end of the month value that I am asking for. I have my criteria set to zero so it should be a perfect match. with the live worksheet I have several tabs for different years. I want to take the end of month balance on each of those year tabs for each month in each fiscal year and add them together. My formula only has the one month because I am unable to get it to work much less adding in all of the years information. I have the employees choosing EOM for the last transaction posted during that month and that calculates the month number in the field next to it. I was thinking I could use the match to look for a specific month in that column and return the balance adjacent to it at that point.

View 7 Replies
View Related
Jun 11, 2014

I've been trying to edit my index formula to only count an order number once even if the criteria for that result appear more than once. Attachment 324723

View 7 Replies
View Related
Jun 24, 2014

I have the first sheet named "DPF" where I have a column "Date", "FIT", "Group" On my second Sheet named "Tracker" what I do want to do:

I select a date for example 18-07-2014 (Cell E3), if cell E4 I Have "Fit" and F4 "Group" In C6 I have E3-15, to get the date minus 15 days (03-07-2014) In C7 I have E3-12 (06-07-2014) and so on

What I want is, if the date of today is C6 or C7 or whatever, use the index match function to get the number corresponding to the date chosen (18-07-2014) for the FIT. But, once I get the figure, I want to keep it, because with the if function, once we are the 4th of July, the figure for C6 disappears...

Fri

18-Jul

FITGroup

Start

D-1503-Jul

D-1206-Jul

D-909-Jul

D-612-Jul

D-615-Jul

D-216-Jul

D-117-Jul

D18-Jul

So either a macro to copy the specific data into another sheet or a another way to keep it. Because the idea as the end is to do different scenario based on the result got per period..

View 2 Replies
View Related
Feb 4, 2014

How to deal with duplicate data in excel using index and match function. Is it possible to use the following function without having a unique value?

View 1 Replies
View Related
Nov 21, 2005

I have a worksheet that has 6 columns of numerical data that all column

datasets are referenced together for each row. So for example the data

in row 5 in all colums is related.

Column C through F have 4 numbers that refer to the data in the first 2

columns. These are also ordered by row.

I need to look in column A for 0.00, and column B for 3.14 Both of

these must be in the same row or I need the closest value. When these

values are found in columns A & B, return the values from the same row

in Columns C through F.

View 13 Replies
View Related
Sep 26, 2011

I am trying to do index match function with criteria ranges in another worksheets. The code kept on giving me " #Value!"..

Here is the code:

Sub test1()

Dim myvalue As Variant

Dim wsname As String

Dim i As Integer

Dim j As Integer

Dim r1 As range

Dim r2 As range

Dim r3 As range

Dim r4 As range

wsname = "CustomerIDbyParts"

[Code] .......

The resulting cell of F5 kept on returning #Value!.. I suspect that my syntax for looking up the ranges from another worksheet is wrong?

View 3 Replies
View Related
Apr 9, 2012

I have an excel workbook with a dynamic dependent drop down list setup, works a treat on the first worksheet i set it up on.

However here's the problem, my workbook contains a good handful of worksheets each named to reflect the certificate on the page, i need the drop down list to work on each tab. problem is when i setup the index/match function it requires a specific sheet name to make it work i.e.

=INDEX(Table1,0,MATCH(PI!$C20,Table1[#Headers],0))

However what i need it to do is reference the worksheet name, as new ones get added and names may change, something like

=INDEX(Table1,0,MATCH(&ActiveSheet.Name&$C20,Table1[#Headers],0))

However this doesn't work, i do have a cell on each page that holds the Sheet name using the function:

=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,256)

But I cant even get it to use that cell as a reference in my formula.

View 9 Replies
View Related
May 8, 2013

I need to find a way to find an array in a tab to use for an index/match function I have.

this is what i would normally use: =index(tab_array,match($a2, tab!$a$1:$a$1000,0),match($B$1,tab!$a$1:$zz$1,0))

This formula would usually work fine when I know that within the tab, the array in which the row match is searching doesn't change. However, that array may change in the future, to say column H, without my knowing as it is a database that gets automatically populated from an upstream system.

Is there a way to search for an array within an index/match?

View 1 Replies
View Related
Jul 12, 2014

I need a formula for left coulmn lookup (using index and matching function) and lookup array has duplicate value.

View 1 Replies
View Related
Jun 4, 2014

I have a data set where the row headings repeat a lot. I have 5 headers repeated probably 30-45 times each. Eg. Truck, Car, Van, Tank, House, Car

At the moment I am using the formula...

=INDEX($B$2:$M$45,MATCH($O$2,$A$2:$A$45,0),MATCH(O4,$B$1:$M$1,0))

which will only return the result of the first occurrence of the cell it is looking for (for eg. I am looking for the values in the cells in columns labelled 'Car', is it possible for it to look past the first occurrence in the data set and find all the values?

View 12 Replies
View Related