0
votes

I'm trying to nest an IF function inside a vlookup to filter data based on a cell in another sheet.

The ideal functionality would be for the cell to return data if it meets a specific criteria otherwise leave it blank.

This is what I have so far:

=IFERROR(vlookup(E2,IF('internal_all[Paste Here]'!H3="Indexable",'internal_all[Paste Here]'!A:AB,""),28,0))

Currently, it doesn't work but instead I get an error "VLOOKUP equates to an out of bounds range".

Any help would be much appreciated.

Here's a copy of my gsheet: https://docs.google.com/spreadsheets/d/13mcOOHIP6-YQKOhE_LHnmu3-7bSNKzvCSTVZ5BnTxPA/edit#gid=0

Here's an example of the error I'm running into: enter image description here

1
share a copy of your sheetplayer0
Could you share where are you getting the error? I can't seem to find itKessy

1 Answers

0
votes

If I understand your question correctly...Then all you would need to change is where you put the if. Including it in the Vlookup will mess with the size of range ie. A:AB has a size of 28 but "" has a size of 0. I would also change your formula to an array so you don't have 6000+ formulas calculating. Finally, I would add an array_constrain to stop the array at the end of your dataset. Here is a working example:

=Array_Constrain(ArrayFormula(IF('internal_all [Paste Here]'!B2:B="Indexable",vlookup(E2:E,'internal_all [Paste Here]'!A2:AB,28,0),"")),CountIf(A2:A,"<>"),1)

I also included that formula in H2 of your "internal links point to canonicalised URLs" tab. Good luck!

Edit:

After looking at the setup again, this updated formula should work.

=Array_Constrain(ArrayFormula(if(VLOOKUP(E2:E,'internal_all [Paste Here]'!A:B,2)="Indexable",vlookup(E2:E,'internal_all [Paste Here]'!A2:AB,28,0),)),CountIf(A2:A,"<>"),1)

Also, here is an updated Indexability formula for column G

=Array_Constrain(ArrayFormula(IFERROR(vlookup(G2:G,'internal_all [Paste Here]'!A:B,2,0))),CountIf(A2:A,"<>"),1)