Lookup iferror, index/match errors

%3CLINGO-SUB%20id%3D%22lingo-sub-1691094%22%20slang%3D%22en-US%22%3ELookup%20iferror%2C%20index%2Fmatch%20errors%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1691094%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20the%20Workers%20Register-%20employees%20are%20segmented%20according%20to%20worker%20type%2C%26nbsp%3B%20department%20and%20role.%20Depending%20on%20the%20department%20selcted-%20employee%20names%20are%20selected%20from%20a%20list.%20Fields%20such%20as%20employee%20number%2C%20employee%20status%20etc%20are%20supposed%20to%20be%20filled%20automatically%20depending%20on%20the%20position%20table%20the%20employee%20is%20stored%20in%20%3CEM%3E%3CSTRONG%3E(that%20is%20multiple%20tables%20searched%20depending%20on%20selection)%3C%2FSTRONG%3E%3C%2FEM%3E.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20formula%20I%20used%20after%20searching%20through%20countless%20forums%20is%20returning%20the%20error%20%22you%20have%20entered%20%3CEM%3Etoo%20many%2Ffew%20arguments%3C%2FEM%3E%20for%20this%20function.%22%20Please%20help%20me%20fix%20it.%3C%2FP%3E%3CDIV%20class%3D%22post-author-login%22%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1691094%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1691289%22%20slang%3D%22en-US%22%3ERe%3A%20Lookup%20iferror%2C%20index%2Fmatch%20errors%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1691289%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F798635%22%20target%3D%22_blank%22%3E%40evitajere%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EData%20structure%20is%20too%20complicated.%20For%20this%20one%20it%20could%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DIFNA(INDEX(INDEX('Dropdown%20Lists'!%24A%241%3A%24AH%2416%2C0%2CMATCH(%5B%40Position%5D%2C'Dropdown%20Lists'!%24A%241%3A%24AH%241%2C0)%2B2)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20MATCH(%5B%40Name%5D%2CINDEX('Dropdown%20Lists'!%24A%241%3A%24AH%2416%2C0%2CMATCH(%5B%40Position%5D%2C'Dropdown%20Lists'!%24A%241%3A%24AH%241%2C0))%2C0)%2C1%0A)%2C%22not%20found%22)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

In the Workers Register- employees are segmented according to worker type,  department and role. Depending on the department selcted- employee names are selected from a list. Fields such as employee number, employee status etc are supposed to be filled automatically depending on the position table the employee is stored in (that is multiple tables searched depending on selection)

 

The formula I used after searching through countless forums is returning the error "you have entered too many/few arguments for this function." Please help me fix it.

10 Replies

@evitajere 

Data structure is too complicated. For this one it could be

=IFNA(INDEX(INDEX('Dropdown Lists'!$A$1:$AH$16,0,MATCH([@Position],'Dropdown Lists'!$A$1:$AH$1,0)+2),
             MATCH([@Name],INDEX('Dropdown Lists'!$A$1:$AH$16,0,MATCH([@Position],'Dropdown Lists'!$A$1:$AH$1,0)),0),1
),"not found")

Interesting @Sergei Baklan I've never come across the IFNA function before!

 

Still, see the attached screenshot when I enter the formula. Its returning #NAME? instead. Workers Register Error.pngWhat could I be doing wrong?

@evitajere 

If you open the file I attached it also returns an error?

No@Sergei Baklan your file doesn't return the same error...you're the real MVP!

 

I notice at the beginning of your formula, you have ..._xlfn.INFA. What does that do? 

 

Also, the formula is meant to be used in other workbooks reading from the Register. Are you able to help me with creating any dummy workbook that references the Workers Register? I'll be most grateful!

@Sergei Baklan. I just read up on the prefix _xlfn:

"Cause. The Excel workbook contains a function that is not supported in the version of Excel that you are currently running. For example, you may have opened a ..."

@evitajere 

On which version of Excel are you? Please check here https://support.microsoft.com/en-us/office/ifna-function-6626c961-a569-42fc-a49d-79b4951fd461 for which ones IFNA is supported.

 

Anyway, instead if it you may use IFERROR(), just replace IFNA on it.

Replacing IFNA with IFERROR worked like magic @Sergei Baklan! Thank you so much! I'm using Office 2010 btw.

 

Let me work on things now. The formula was the missing piece! 

@evitajere , okay, great to know you sorted this out

Using the IFEEROR, INDEX and MATCH Formula
We want to get a product description in the cell F3, from the lookup table H3:I9, based on the Product ID 103 in the cell C3. If Product ID 103 is not found in the lookup table, we want to return “Description missing” in F3.

The formula looks like:

=IFERROR(INDEX($H$3:$I$9, MATCH(C3, $H$3:$H$9, 0), 2), “Description missing”)

The lookup_value parameter of the MATCH function is C3. The lookup_array is $H$3:$H$9, while the match_type is 0, as we want the exact match. The result of the MATCH function is the row_num parameter of the INDEX function. The array the range $H$3:$I$9. Finally, the value parameter of the IFERROR function is the result of the INDEX function, while the value_if_error is “Description missing”.

To apply the formula, we need to follow these steps:

Select cell F3 and click on it
Insert the formula: =IFERROR(INDEX($H$3:$I$9, MATCH(C3, $H$3:$H$9, 0), 2), "Description missing")
Press enter
Drag the formula down to the other cells in the column by clicking and dragging the little “+” icon at the bottom-right of the cell.

@Lewis-H 

For this concrete example I'd recommend

=IFERROR(INDEX($I$3:$I$9, MATCH(C3, $H$3:$H$9, 0)), “Description missing”)

Why to replicate the weakness of VLOOKUP()?