Excel index match with two different sheets gives me #VALUE error - excel

I am trying to do an index match on two tables from two different sheets.
I have tried using a + sign to add the two different index match formulas
I have tried to add the index and match functions with commas
=IFERROR(INDEX(Building!$H$4:$H$3490,MATCH($I5,Building!$A$4:$A$3490,0)),0)
works
=IFERROR(INDEX(AltCapID!$H$2:$H$608,MATCH($A5,AltCapID!$A$2:$A$608,0)),0)
works
what I want is if the first condition doesn't exist to execute the second formula
Current formula:
=IFERROR(INDEX(Building!$H$4:$H$3490,MATCH($I6,Building!$A$4:$A$3490,0)),0)+IFERROR(INDEX(AltCapID!$H$2:$H$608,MATCH($A6,AltCapID!$A$2:$A$608,0)),0)
I6 matches the value in Building!$A$4:$A$3490 so I am expecting the results from Building!$H$4:$H$3490 instead I am getting an #VALUE error

After reading my answer again, I realized all I needed was an if statement. So I added
=IF(A5="",IFERROR(INDEX(Building!$H$4:$H$3490,MATCH($A5,AltCapID!$A$2:$A$608,0)),0)),IFERROR(INDEX(AltCapID!$H$2:$H$608,MATCH($A5,AltCapID!$A$2:$A$608,0)),0))
In my table Column A is empty if that cell is to be used

After editing your question, what you are looking is the following formula:
=IFERROR(INDEX(Building!$H$4:$H$3490,MATCH($I5,Building!$A$4:$A$3490,0)),IFERROR(INDEX(AltCapID!$H$2:$H$608,MATCH($A5,AltCapID!$A$2:$A$608,0)),0))

Related

Index Match within an index match? or Index matching from two different sheets - Excel formula

I am using an index match in the main sheet 1 to find one set of values pulling from sheet 2 but is it possible to search in sheet 3 if the value results in #NA? or is there another formula statement to begin with instead?
Formula:
INDEX(Sheet_2!C:C,MATCH('Sheet_1'!B2, Sheet_2!B:B,0))
Not sure of its helpful but matching on orderids and indexing the varying company's names.
Thank you,
Jmar
Wrap in IFERROR()
=IFERROR(INDEX(Sheet_2!C:C,MATCH('Sheet_1'!B2, Sheet_2!B:B,0)),INDEX(Sheet_3!C:C,MATCH('Sheet_1'!B2, Sheet_3!B:B,0)))
Now it will search the third tab if the second tab return an error.

Using MATCH function as range in VLOOKUP function in Excel

Main Problem statement : To retrieve multiple matches in excel.
I have 3 columns starting from AD to AF.AD has multiple matches.I need to retrieve AF values for matched AD value.
I searched on net and got the below formula.
=IFERROR(INDEX($B$3:$B$13,SMALL(IF(D$2=$A$3:$A$13,ROW($A$3:$A$13)- MIN(ROW($A$3:$A$13))+1,""), ROW()-2)),"")
But I am trying to implement my own solution.I am trying to use MATCH function as range in VLOOKUP function.Then change the range of MATCH function to retrieve 2nd match and so on.Continue this until there is no match found.
Here is what I tried which is giving an #NAME error.
=VLOOKUP(AD3,AD&EVAL("=MATCH(AD3,AD:AD,0)"):AF1000,3,0)
Also,it would be very appreciated if there is another solution to the main problem statement.
If this is the right direction to proceed,please help to complete this formula.
Thanks.
Main Problem statement : To retrieve multiple matches in excel.
Now I have to get multiple matches and compare them if they are equal.
You seem to have an XY Problem. You are concentrating on resolving the first half of your formula problem while ignoring a simpler solution that would resolve the entire task.
=and(countif(ad:ad, ad3)=countifs(ad:ad, ad3, af:af, af3))
True if all related values in column AF where column AD is equal to AD3 are the same; false if column AF contains differing values.

VLOOKUP is malfunctioning in Excel?

I have been working on this issue for over two hours and I am beginning to question my sanity. I have used vlookup many times in the past, but now it is just not working as expected. I am trying to replicate a LEFT-JOIN (from SQL) in Excel using vlookup.
Here is the formula I am using on cell G2:
Here is the table of all the values I want to lookup values for.
Here is the table I am using as a reference:
I am only searching one column to simplify the example. Cell G2 contains the formula which is applied to the cells under it as well. As you can see from the first image, not only is it not matching but there is some pretty weird behavior going on.
I have removed duplicates for both tables.
I have unformatted the data to plain text values
I have tried this formula on three different computers
Regardless, I keep kept getting the same result! I am starting to lose sanity.
Does anyone have any idea?
Thank you
If you want exact matches, you should be using FALSE as the last parameter
The lookup table must be sorted in ascending order. Cell A369 appears to have a value lower than the row before it, A368. There are several instances of "lower" values occurring after a higher value.
Before you go insane, consider sorting the range $A$368 thru $A$679, and see if that makes a difference.
Otherwise, time to ditch VLOOKUP, and use instead INDEX and MATCH.
Sometimes you can get the #N/A error if your lookup_value isn't "clean". If that's the case, try this formula:
=VLOOKUP(TRIM(CLEAN(A2)),$A$368:$A$697,1,FALSE)
Additionally, your table_array may have "unclean" data, so you'll need to scrub that first before you're able to find a match. To do that, use this array formula, committing it with Ctrl + Shift + Enter:
=VLOOKUP(A2,TRIM(CLEAN($A$368:$A$697)),1,FALSE)
Have you tried doing a MATCH? does it need to be VLOOKUP?
if you are happy using match try:
=IF(MATCH(A2,$A$368:$A$697,0),A2,"NO MATCH")

Using Sumproduct with ranges and cell references

I am attempting to use sumproduct in replace of sumifs so I can use multiple criteria within a single range. What works so far is:
=SUMPRODUCT(Table2[Sum of MKTValue],--ISNUMBER(MATCH(Table2[Code],{"EG1","EG2"},0)),--ISNUMBER(MATCH(Table2[Currency],{"GBP","USD","EUR"},0)),(Table2[Final Date]=INDIRECT("J"&SUM(ROW()-102)))*1)
However I need the "J" column reference, when I attempt to drive this using the current column as below:
=SUMPRODUCT(Table2[Sum of MKTValue],--ISNUMBER(MATCH(Table2[Code],{"EG1","EG2"},0)),--ISNUMBER(MATCH(Table2[Currency],{"GBP","USD","EUR"},0)),(Table2[Final Date]=INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","")&SUM(ROW()-102)))*1)
Then I am getting a #VALUE error. I have tried a number of different varieties of the above but I cannot get it to work.
Thanks for your help.
I assume that Jn contains a valid date - try moving the SUM function to outside INDIRECT, i.e. with last criterion
(Table2[Final Date]=SUM(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","")&ROW()-102))*1

simplifying Excel formula currently using INDEX, ROW, SUMPRODUCT and IFERROR

Does anyone have any brilliant ideas to simplify this difficult formula? Don't panic when you see it, I will try to explain.
=IFERROR(INDEX(rangeOfDesiredValues,(1/SUMPRODUCT((rangeOfSerials=$D20)(rangeOfApps=cfgAppID)(rangeOfAccessIDs=cfgAccessID)*ROW(rangeOfDesiredValues))^-1)),"")
Currently I am using SUMPRODUCT to do the equivalent of a VLOOKUP with multiple columns as criteria. Usually that only works with number results, but since I need to find text, I'm using SUMPRODUCT in combination with ROW and INDEX.
Unfortunately when no cell is found, my SUMPRODUCT returns 0. This causes the formula to return the incorrect cell rather than blank. For this reason I am running the result through this calculation:
(1 / result)^-1
This way results of 0 become an error, and other results remain unchanged. I feed this into IFERROR, so that errors become blanks.
Does anyone know how to make this neater? I am not able to create new columns in any of my spreadsheets.
It's always best to avoid using multi-condition summing functions like SUMPRODUCT when you want to find a single value (it would obviously give you an incorrect result or error if there's more than one row which matches all three conditions, I assume you expect one match at most here?). ROW function can also be problematic if you insert any rows in the worksheet.....
There are several approaches that can work. For a single formula, using MATCH is the most common - MATCH will only give the correct position or an error so no problems with zero values. That would look like this:
=IFERROR(INDEX(rangeOfDesiredValues,MATCH(1,(rangeOfSerials=$D20)*(rangeOfApps=cfgAppID)*(rangeOfAccessIDs=cfgAccessID),0)),"")
That's an "array formula" that needs to be entered with CTRL+SHIFT+ENTER......or you can make it into a regular formula with an extra INDEX function like this
=IFERROR(INDEX(rangeOfDesiredValues,MATCH(1,INDEX((rangeOfSerials=$D20)*(rangeOfApps=cfgAppID)*(rangeOfAccessIDs=cfgAccessID),0),0)),"")
A third alternative is to use LOOKUP which doesn't need "array entry"
=IFERROR(LOOKUP(2,1/(rangeOfSerials=$D20)/(rangeOfApps=cfgAppID)/(rangeOfAccessIDs=cfgAccessID),rangeOfDesiredValues),"")
That differs slightly from the previous versions in the case of multiple matches - it will give you the last match rather than the first in that scenario (but I assume you have only one match at most, as stated above).
Finally, if you don't mind using helper columns you could simplify the formulas considerably. Just use a "helper" column to concatenate the three criteria columns separated by dashes and then you can use a simple VLOOKUP or INDEX/MATCH, e.g.
=IFERROR(INDEX(rangeOfDesiredValues,MATCH($D20&"-"&cfgAppID&"-"&cfgAccessID,Helper_Column,0)),"")

Resources