+ Reply to Thread
Results 1 to 13 of 13

IF Statement Not Working Across Sheets

  1. #1
    Registered User
    Join Date
    01-23-2019
    Location
    Maine
    MS-Off Ver
    Office 365
    Posts
    6

    Question IF Statement Not Working Across Sheets

    Hello All,
    I need some help with a nested if statement.

    I'm trying to pull a cells data from one sheet to another if it meets 2 requirements.
    1, If Column A states "RF Module 1" and 2, If Column B states "RF Drive Power" to pull Column C.

    Excel Sheet 1.PNG

    This formula is working correctly if I keep it on the same sheet. But if I write the formula on a different sheet (which I need to do) I get a value error.

    Formula that works: =IF(A180:A181=A180,IF(B180:B181=B180,C180))

    Formula that does not work: =IF(Sheet1!A180:A181=Sheet2!B1,IF(Sheet1!B180:B181=Sheet2!A2,Sheet1!C180))
    This gives me a #Value! error.

    Is there a better way to do this or is something wrong?

    Thanks,
    Bdenn
    Last edited by bdenn; 01-23-2019 at 03:12 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,411

    Re: IF Statement Not Working Across Sheets

    Will you please attach a sample Excel workbook?

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired results are also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    01-23-2019
    Location
    Maine
    MS-Off Ver
    Office 365
    Posts
    6

    Re: IF Statement Not Working Across Sheets

    Attached is an excel document with realistic data.

    Thanks,
    Bdenn
    Attached Files Attached Files

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: IF Statement Not Working Across Sheets

    I'm not sure how your first one works =IF(A180:A181=A180,IF(B180:B181=B180,C180)) as I copied it and put it in sheet1 and it returned value.
    is this what you are looking for?
    =IF(OR(Sheet1!A180=Sheet2!B1,Sheet1!A181=Sheet2!B1,Sheet1!B180=Sheet2!A2,Sheet1!B181=Sheet2!A2),Sheet1!C180,"")
    BTW, you wrote
    If Column A states "RF Module 1" and 2, If Column B states "RF Drive Power" to pull Column C.
    But when I look at what is across from RF module 1 and RF drive power it isn't 6.3, it is 2575.9833.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  5. #5
    Registered User
    Join Date
    01-23-2019
    Location
    Maine
    MS-Off Ver
    Office 365
    Posts
    6

    Question Re: IF Statement Not Working Across Sheets

    Hello,
    That formula did not seem to work.

    I have redone my example to try and get better results. I'm looking for a formula that will check all of column A and all of column B
    in sheet 1 and if they match the row and column in sheet 2 then input the data from column C in sheet 1 to sheet 2.

    Attached is another document with detailed notes.

    Thanks,
    Bdenn
    Attached Files Attached Files

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: IF Statement Not Working Across Sheets

    ok, I did it with this...
    =SUMPRODUCT((Sheet1!$A:$A=Sheet2!B$1)*(Sheet1!$B:$B=Sheet2!$A2),Sheet1!$C:$C)
    dragged across and down. If you don't want to use whole columns you can limit the references to just the areas with the data.

  7. #7
    Registered User
    Join Date
    01-23-2019
    Location
    Maine
    MS-Off Ver
    Office 365
    Posts
    6

    Re: IF Statement Not Working Across Sheets

    Hello,
    This works for the most part. I have changed one value on my document. On Sheet 1 I have placed 1.6.10.3 and when I run the formula it returns 0, I'm guessing it is because this is calculating and not pulling the exact information?

    In my document that I'm trying to pull all this data from that value "1.6.10.3" shows up a lot.

    Thanks,
    Bdenn
    Attached Files Attached Files

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,411

    Re: IF Statement Not Working Across Sheets

    It's a job done in seconds using Power Query.

    Here's the M code:

    Please Login or Register  to view this content.
    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    1
    Column2 Account 1 Account 2 Account 3
    2
    A 1.6.10.3
    3
    4.5
    3
    B
    1.6
    3.1
    4.6
    4
    C
    1.7
    3.2
    4.7
    5
    D
    1.8
    3.3
    4.8
    6
    E
    1.9
    3.4
    4.9
    7
    F
    2
    3.5
    5
    8
    G
    2.1
    3.6
    5.1
    9
    H
    2.2
    3.7
    5.2
    10
    I
    2.3
    3.8
    5.3
    11
    J
    2.4
    3.9
    5.4
    12
    K
    2.5
    4
    5.5
    13
    L
    2.6
    4.1
    5.6
    14
    M
    2.7
    4.2
    5.7
    15
    N
    2.8
    4.3
    5.8
    16
    O
    2.9
    4.4
    5.9
    Sheet: Sheet3
    Attached Files Attached Files

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,411

    Re: IF Statement Not Working Across Sheets

    Let me know if you need help with this.

  10. #10
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: IF Statement Not Working Across Sheets

    Or try lookup
    B2
    =LOOKUP(1,1/(Sheet1!$A$1:$A$45=B$1)/(Sheet1!$B$1:$B$45=$A2),Sheet1!$C$1:$C$45)
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    01-23-2019
    Location
    Maine
    MS-Off Ver
    Office 365
    Posts
    6

    Re: IF Statement Not Working Across Sheets

    Hello AliGW,
    I have not really worked with Power Query. I would like to keep this all as formulas because of how I need to manipulate the data each month. (Create A New Sheet each time.)

    Is there really not a good formula that would work for this? Looks like the sumproduct is doing some math that works for 95% of the data. But if it is not real numbers such as 1.3.4.10 then it will return 0 or some cells read "N/A" which also returns 0.

    Maybe i'm wrong (probably) but I would think there is a good formula that would work such as: if A = this and B = that, then take C and return it on sheet 2. Return on sheet 2 if it is a number, letters, or 1.3.4.10, etc.

    Thanks,
    Brandon

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,411

    Re: IF Statement Not Working Across Sheets

    Have a look at Bo_Ry's suggestion.

    I had not really worked with Power Query once ... Now I would not look back. But if you are not ready for it yet, that's fine. Just shout if you decide you want to look at it more closely in the future.

  13. #13
    Registered User
    Join Date
    01-23-2019
    Location
    Maine
    MS-Off Ver
    Office 365
    Posts
    6

    Re: IF Statement Not Working Across Sheets

    Hello Bo_Ry,
    You have done it!! This works exactly like I was looking for it to!

    I have turned a 20 page document into 1 page using this formula.

    Thanks so much.
    -Bdenn

+ 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. multiple if statement not working but not working (make sense!)
    By vanessafvg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-17-2018, 12:06 AM
  2. From Excel working to Google Sheets no longer working
    By rad1964 in forum Excel General
    Replies: 5
    Last Post: 07-19-2016, 10:23 PM
  3. [SOLVED] For Next Statement: Hiding Columns on Successive Sheets not Working
    By mandora in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-08-2013, 03:01 AM
  4. Max If statement not working across multiple sheets
    By Robmeister89 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-26-2013, 08:49 AM
  5. [SOLVED] countifs working on extended ranges and different sheets not working
    By etaf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-18-2013, 02:23 PM
  6. [SOLVED] VBA coding only working in the first sheet. It is not working in all the sheets
    By srinivasan1965 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-16-2012, 02:04 PM
  7. Working While Statement Stops Working
    By Verbaruab in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2011, 05:58 PM

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