Suppress #N/A returned by Google Sheets vlookup

前端 未结 3 1730
天命终不由人
天命终不由人 2021-02-06 21:22

I have a Google Sheet (example) with a basic vlookup to create a summable column. It returns \"#N/A\" for every search key not found, and attaches the following error to those c

3条回答
  •  离开以前
    2021-02-06 22:04

    A simpler way to suppress error messages - of any kind - is to use the iferror wrapper:

    =iferror(vlookup(A1,Lookup!A:B,2,FALSE))
    

    I don't think there can be an easier way than that. By design, vlookup should not simply return blank if the key wasn't found: this would be indistinguishable from the situation where the key was found but the corresponding entry in second column was blank. Some error has to be thrown, and then it's up to the spreadsheet user how to handle it.

提交回复
热议问题