+ Reply to Thread
Results 1 to 5 of 5

Using an Indirect formula within a IF Statement

  1. #1
    Registered User
    Join Date
    10-24-2017
    Location
    Portsmouth, England
    MS-Off Ver
    2013
    Posts
    16

    Using an Indirect formula within a IF Statement

    So I have workbook with sheets named for each employee in my company, and then have a sheet summarizing the data. In the summary sheet I want to say IF a certain cell in the summary matches a certain cell in the employee sheet, give me 1, if it doesn't give me 0. (I aim to replace the 1 with a hlookup afterwards, however one thing at a time). The current formula I'm using is:

    =IF(INDIRECT(B6&"!D26")=E5,1,0) B6 is the employee's name, D26 is a cell in the employee sheet that will either match E5 or won't.

    This however returns the #REF! error.

    I have also tried:

    =IF(INDIRECT("'"&$B6&"'!D26")=E5,1,0)

    Which returns the same error.

    Does anyone have any ideas?
    Last edited by aimeepebbles; 11-07-2017 at 06:41 AM. Reason: I have found the issue

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    27,999

    Re: Using an Indirect formula within a IF Statement

    this works

    =IF(INDIRECT("'"&$B6&"'!D26")=E5,1,0)

    so error is in B6 or Sheet named in B6 does not exist

    Check for extraneous blanks in B6

  3. #3
    Registered User
    Join Date
    10-24-2017
    Location
    Portsmouth, England
    MS-Off Ver
    2013
    Posts
    16

    Re: Using an Indirect formula within a IF Statement

    B6 is definitely matches a sheet because this works in another cell:

    =IFERROR(HLOOKUP($C$2,INDIRECT("'"&$B6&"'!$10:$34"),12,FALSE),0)

  4. #4
    Registered User
    Join Date
    10-24-2017
    Location
    Portsmouth, England
    MS-Off Ver
    2013
    Posts
    16

    Re: Using an Indirect formula within a IF Statement

    I have found the issue, thanks for your help

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    27,999

    Re: Using an Indirect formula within a IF Statement

    You will only get a reference error if B6 is incorrect

    Attach a sample workbook (not image).

    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate.

    Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replace IF THEN ELSEIF statement with INDIRECT function?
    By xntdriver in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-04-2016, 05:50 PM
  2. [SOLVED] How to populate a list from an indirect reference using an IF statement.
    By Broderick in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-07-2015, 01:14 AM
  3. VLOOKUP or INDEX-MATCH + INDIRECT with Nested IF/OR Statement
    By djmyers in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-11-2015, 10:40 PM
  4. How to indirect address the date in VB's Array statement
    By bernoulli in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-19-2012, 11:58 PM
  5. Replies: 1
    Last Post: 02-10-2012, 02:53 AM
  6. Replies: 2
    Last Post: 10-30-2011, 05:15 PM
  7. If statement with indirect & Vlookup
    By Merlin54k in forum Excel General
    Replies: 1
    Last Post: 08-01-2007, 12:24 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1