Google Sheets中带FALSE的嵌套VLOOKUP匹配库存价格故障求助
Fixing Nested VLOOKUP for Price Lookup in Google Sheets
First, let's get you the working formula that prioritizes your pricedata range first, then falls back to oldprice if no match is found. Here's what you need to use:
=IFERROR(VLOOKUP(A3, pricedata, 2, FALSE), VLOOKUP(A3, oldprice, 2, FALSE))
Let's break this down:
IFERROR: This function catches the #N/A error that pops up when the first VLOOKUP can't find a match forA3inpricedata, then automatically runs the second VLOOKUP onoldpriceinstead.VLOOKUP(A3, pricedata, 2, FALSE): Looks for an exact match ofA3in the first column ofpricedata, and returns the value from the 2nd column of that range (adjust the2to match the column number where your price lives inpricedata).VLOOKUP(A3, oldprice, 2, FALSE): The fallback lookup, using the same exact-match logic but on your older price dataset.
Common Issues That Might Be Breaking Your Original Formula
If this formula still isn't behaving as expected, check these common pitfalls:
- Incorrect Named Range Setup: Make sure both
pricedataandoldpriceinclude both the description column (A) and the price column in their range. For example, if your new prices are inSheet2!A:B,pricedatashould point to that entire range—not justSheet2!A:A. - Wrong Column Index: The number
2in the formula refers to the position of the price column within the named range, not the sheet's absolute column number. If your price is in the 3rd column ofpricedata, change that to3. - Mismatched Descriptions: Since you're using
FALSEfor exact matches, tiny differences (extra spaces, punctuation, or even hidden line breaks) will cause a mismatch. Clean up your descriptions withTRIMif needed:=IFERROR(VLOOKUP(TRIM(A3), pricedata, 2, FALSE), VLOOKUP(TRIM(A3), oldprice, 2, FALSE)) - Named Range Scope: Double-check that your named ranges are scoped correctly (either "Workbook" or the specific sheet you're working in). You can verify this under Data > Named ranges.
Content of the question originates from Stack Exchange, asked by Shipping Receiving
相关产品推荐
相关产品推荐

