+ Reply to Thread
Results 1 to 23 of 23

IF Statement Issues

  1. #1
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    19

    IF Statement Issues

    I am using an If statement to do a look up in a table of values (all numbers). I have it created so that it will go through a set of IF statements and return a 1 if all of those statements are false. It keeps returning the answer false instead of the 1 I am wanting. See below for statement.

    =IF(P3=2,IF(P4=50,IF(P5=12,IF(P6=43,Sheet2!$G$8,IF(P3=2,IF(P4=50,IF(P5=12,IF(P6=54,Sheet2!$G$9,IF(P3=2,IF(P4=50,IF(P5=12,IF(P6=68,Sheet2!$G$10,IF(P3=2,IF(P4=50,IF(P5=12,IF(P6=97,Sheet2!$G$11,1))))))))))))))))

    Thank you for your help.

  2. #2
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: IF Statement Issues

    You don't have a false statement for the first 4 IFs and loads in between.

    So IF P3 doesn't = 2 then it will return FALSE. Then lots of those inbetween.

    A sample file would be best here so we can re-write your formula to correct effect.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: IF Statement Issues

    Almost certainly you need a VLOOKUP table, so as Dave suggests upload the workbook.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    19

    Re: IF Statement Issues

    The IF statements are labeled as false at the moment. The table lookup is on the second page. I would use a Vlookup but I am changing multiple parameters not just a simple column row table. Right now the if statement is working exactly how I want it to with the pulling from the multiple parameters the only thing is I want it to a return a 1 if all of those statements are false.
    Attached Files Attached Files
    Last edited by ruddellq; 04-28-2017 at 08:56 AM.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: IF Statement Issues

    Hi,

    I still can't help thinking that this could be simplified considerably by adding an additional column A to your data on sheet2. So A4 copied down
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I'm assuming you're wanting to know whether the values in P3:P6 on sheet 1 are present in the Sheet2 table, hence a simple
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    will return the row number if those P3:P6 values are present. And if you want to return a value of 1 if they're not then wrap it in an IF(ISERROR()) function

    i.e.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    19

    Re: IF Statement Issues

    When you say add an additional column A to my data table what would go in this column?

    Are your second and third statement the way to use multiple parameters (ie P3:P6) to look up data in my table?

  7. #7
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    19

    Re: IF Statement Issues

    Essentially what I want to do is create a statement that will use P3:P6 to match the first four column of my data table and return the value of the 5th column.

    So if P3:P6 equals 1, 33, 6, 43 then I would get 5347. (The first row of data table.) If there is an easier way to do this than an if statement I am all for it.

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: IF Statement Issues

    Hi,

    I meant populate the column A alongside your table. i.e in A4 enter
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and copy down.

    I am presuming that you want in some way to check whether all the P3:P6 values etc. on sheet 1 are in your table, and concatenating the relevant table values in one cell is a common way to do this. If the MATCH formula finds that concatenated string then it will return the number of the row where it's found. Obviously if it's not found then the MATCH returns an Error and hence the =IF(ISERROR()) returns the 1 you said you needed

    If however I've misunderstood and this is not what you're after then explain in a narrative comment what you're trying to do.

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: IF Statement Issues

    Quote Originally Posted by ruddellq View Post
    Essentially what I want to do is create a statement that will use P3:P6 to match the first four column of my data table and return the value of the 5th column.

    So if P3:P6 equals 1, 33, 6, 43 then I would get 5347. (The first row of data table.) If there is an easier way to do this than an if statement I am all for it.
    OK, I hadn't seen this post when I posted just now.

    So as I said add the helper column A formula I mentioned and to find the 5th column value use the formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    19

    Re: IF Statement Issues

    When I enter that formula I get #N/A. Check to see if I entered the helper column correctly.
    Attached Files Attached Files

  11. #11
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: IF Statement Issues

    Hi,

    In sheet2 you just forgot to preface the A4 formula with the = sign to make it a formula and not just any old string. i.e.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    19

    Re: IF Statement Issues

    That did the trick! Thank you so much for all your help!

  13. #13
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    19

    Re: IF Statement Issues

    I'm running into another problem. I 'm trying to do the same thing with a different data table. I created the helper column again and copied over the formula but it keeps spitting out #n/a.

    =INDEX(Sheet2!$S$4:$S$10,MATCH(V2&"_"&V3,Sheet2!$P$4:$P$10,FALSE),1)

  14. #14
    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,271

    Re: IF Statement Issues

    Attach the workbook.
    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.

  15. #15
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    19

    Re: IF Statement Issues

    I'm running into another problem. I 'm trying to do the same thing with a different data table. I created the helper column again and copied over the formula but it keeps spitting out #n/a.

    =INDEX(Sheet2!$S$4:$S$10,MATCH(V2&"_"&V3,Sheet2!$P$4:$P$10,FALSE),1)

  16. #16
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: IF Statement Issues

    Quote Originally Posted by ruddellq View Post
    I'm running into another problem. I 'm trying to do the same thing with a different data table. I created the helper column again and copied over the formula but it keeps spitting out #n/a.

    =INDEX(Sheet2!$S$4:$S$10,MATCH(V2&"_"&V3,Sheet2!$P$4:$P$10,FALSE),1)
    Is Column P on Sheet 2 the helper column?

    Have you manually checked that the V2 & "_" & V3 string does exist in column P?

  17. #17
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    19

    Re: IF Statement Issues

    The problem is occurring with the Weld Connections. (Weld Strength) The lookup table is on the 2nd sheet.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    19

    Re: IF Statement Issues

    Column P is the helper column correct. V2 and V3 do exist in column P.

  19. #19
    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,271

    Re: IF Statement Issues

    33_97 doesn't exist on the second sheet, but 97_33 does - you have got the numbers the wrong way round.

  20. #20
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: IF Statement Issues

    The helper column P needs to have the Yield & Gauge idenifiers in the same order as V2 & V3. i.e. you have them the wrong way round.
    P4 should be

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    and not

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  21. #21
    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
    28,135

    Re: IF Statement Issues

    You lookup "33_97" but the table has "97_33" : hence no match.

  22. #22
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    19

    Re: IF Statement Issues

    That did the trick. I've been in excel to long. Thank you for your help!

  23. #23
    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,271

    Re: IF Statement Issues

    You're welcome!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. [SOLVED] VBA IF statement issues
    By zhead in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-22-2017, 02:35 PM
  2. [SOLVED] Having some issues with using an OR statement.
    By AceForSale in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 03-23-2016, 03:53 PM
  3. [SOLVED] Having issues with If statement
    By dmory88 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-20-2015, 01:19 PM
  4. IF Statement Issues
    By AFWard in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-27-2015, 04:55 AM
  5. [SOLVED] Multiple IF statement issues
    By DPW in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-11-2014, 12:29 AM
  6. [SOLVED] If nested statement issues
    By winter12 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-12-2013, 10:51 AM
  7. HELP! - IF Statement Issues
    By MGeorges in forum Excel General
    Replies: 2
    Last Post: 02-09-2005, 07:35 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