Forum Discussion

nikkil85's avatar
nikkil85
Copper Contributor
Feb 22, 2024

Vlook up function causing file open prompt

I am trying to compare information from two pivot charts - in Pivot Table A - I have company names in column A, then the number of devices said company is paying for in column B. In Pivot Table B - I have company names in column D and the number of devices we have listed in our system in column E. I want to show the difference between computers from Pivot Table A and Pivot Table B. I want to be able to look at a glance if the number from column B is larger or smaller than column E. However there are more company names in Pivot Table A than Pivot Table B, so i can not just compare the cells. 

I already copied the company names from both pivot tables into column G and removed duplicates, but when i try to paste this function =IFERROR(VLOOKUP(G2, 'Pivot Table A'!$A$2:$B$100, 2, FALSE) - VLOOKUP(G2, 'Pivot Table B'!$D$2:$E$100, 2, FALSE), "") it does not calculate at all, and when i hit enter it tries to open a file - i have copied it pasted it in everyway imaginable ------please help

4 Replies

  • nikkil85 

    Based on your description, there are a few potential issues that might be causing the problem:

    1. Incorrect File Reference:

    • Double-check the file path in your VLOOKUP formula. Ensure the paths to both Pivot Tables are accurate and enclosed in single quotes (e.g., 'Pivot Table A'!$A$2:$B$100).

    2. Circular Reference:

    • If your VLOOKUP formula references itself or other cells containing the formula, it can create a circular reference, leading to the file open prompt. Carefully review the formula and ensure there are no circular references.

    3. Missing Workbook:

    • Make sure both Pivot Tables (Pivot Table A and Pivot Table B) are in the same workbook as the sheet where you're using the VLOOKUP formula. If they're in separate workbooks, you'll need to use the full file path in the reference (e.g., '[Path to Workbook.xlsx]Pivot Table A'!$A$2:$B$100).

    4. Data Type Mismatch:

    • Ensure the data types (e.g., text, numbers) in the lookup columns (G2 in your case) and the return columns (column B in Pivot Table A and column E in Pivot Table B) are consistent. If there's a mismatch, VLOOKUP might not function correctly.

    5. Formula Syntax Error:

    • Check the syntax of your VLOOKUP formula carefully. Ensure you have the correct number of arguments and that they are separated by commas.

    Additional Tips:

    • Try using the INDEX and MATCH functions instead of VLOOKUP. These can be more flexible and less prone to circular references.
    • Consider using named ranges to define your pivot table ranges. This can make the formula easier to read and maintain.
    • If you're still facing issues, provide more details about your spreadsheet setup, including screenshots of your pivot tables and formula, and I can try to assist you further.

    Remember, the key is to identify the specific cause of the file open prompt and address it accordingly. By carefully analyzing the potential issues and trying the suggested solutions, you should be able to resolve the problem and use the VLOOKUP function effectively.

  • djclements's avatar
    djclements
    Bronze Contributor

    nikkil85 Are 'Pivot Table A' and 'Pivot Table B' the names of your pivot tables, or the names of the worksheets where the pivot tables are located? Unlike an Excel table, a pivot table cannot be referenced in a formula by name. In your first VLOOKUP formula, for example, 'Pivot Table A'!$A$2:$B$100 is referring to range A2:B100 on worksheet 'Pivot Table A'. If no such worksheet name exists in the workbook, Excel assumes the range reference is external, and will prompt you to open the source file where this range can be found. Be sure to use the Sheet Name in your formula where the data is located.

     

    If you're still experiencing issues, please consider sharing a mock-up file, or screenshots showing your current setup (including the sheet tabs) with sensitive data blacked-out. There may be alternative methods to VLOOKUP that are more appropriate here, but additional information is required in order to make such suggestions.

Resources