+ Reply to Thread
Results 1 to 8 of 8

=IF( Question - Tough one, pretty convoluted

  1. #1
    Registered User
    Join Date
    11-03-2018
    Location
    California
    MS-Off Ver
    Mac Version 16.16.2
    Posts
    20

    =IF( Question - Tough one, pretty convoluted

    Hi group,

    I am working out a bug and have come to a block.
    I want cell "1"!CK3 (highlighted orange) to display a value when cell "1"!AR3 uses a negative number.
    Currently it appears to default to a blank.

    The current formula is:

    =IF(AND(AR3="",AR3<0,CD3="",CG3=""),"",IF(AND(AR3>0,OR(AW3={"Plug","bolt","studs","EXPMETAL"})),AR3*CG3,IF(AND(AR3>0,OR(AW3={"Angle","Bar","WF","Channel","Hss","Pipe","Plate"})),CD3*CG3,IF(AND(AR3>0,OR(AW3={"REBAR","ALLTHRD"})),BQ3*CG3,IF(AND(AR3>0,OR(AW3={"decking","grating","expmetal"})),BY3*CG3,"")))))x

    Attached is excel file...

    Thanks for any comments where I'm going wrong
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: =IF( Question - Tough one, pretty convoluted

    wow why is it necessary to use all those merged cells? We all hate them here and advise avoiding them if at all possible - they cause all sorts of problems with formulas/sorting/macros etc.
    I did a quick scan of your sheet and can see no valid reason to use them - if you need wider cells to show stuff, just make the column wider
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    11-03-2018
    Location
    California
    MS-Off Ver
    Mac Version 16.16.2
    Posts
    20

    Re: =IF( Question - Tough one, pretty convoluted

    Hey thanks, for the kick in the teeth I presume.
    I will undoubtably admit my intelligence is likely not as developed as other members, but I still like coming to the group when I have questions.
    IDK...maybe I took your reply wrong, I apologize if I did.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: =IF( Question - Tough one, pretty convoluted

    OK picking through your formula....
    you are testing for....
    AND(AR3="",AR3<0,CD3="",CG3="")
    if all are met, "", however, both CD and CG are not "", so it goes on to the next test, which is...
    IF(AR3>0,...then do a bunch more tests.

    However, AR3 is <0, so all those tests fail.
    Excel does not know what to do next, so it returns FALSE

    You need to work on that 1st IF/AND statement to cater for when CD and/or CG are not empty

    I simplified your formula a bit too, to do away with the repetitive test for AR3>0...
    =IF(AND(AR3="",AR3<0,CD3="",CG3=""),"",
    IF(AR3>0,
    IF(AW3={"Plug","bolt","studs","EXPMETAL"},AR3*CG3,
    IF(AW3={"Angle","Bar","WF","Channel","Hss","Pipe","Plate"},CD3*CG3,
    IF(AW3={"REBAR","ALLTHRD"},BQ3*CG3,IF(AW3={"decking","grating","expmetal"},BY3*CG3,""))))))
    So you need to just work on that 1st line (bolded)

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: =IF( Question - Tough one, pretty convoluted

    Quote Originally Posted by DGARDNERMAN View Post
    Hey thanks, for the kick in the teeth I presume.
    I will undoubtably admit my intelligence is likely not as developed as other members, but I still like coming to the group when I have questions.
    IDK...maybe I took your reply wrong, I apologize if I did.
    aplogies, was not meant as a put-down, I can see now how that might have come across that way

  6. #6
    Registered User
    Join Date
    11-03-2018
    Location
    California
    MS-Off Ver
    Mac Version 16.16.2
    Posts
    20

    Re: =IF( Question - Tough one, pretty convoluted

    I revised the formula and it works, but o dread, it comes back as a positive number, wheres if its basing its finding from AR3 ( i.e."-12" ), it should return a negative result.
    hmmm...

    I'm using this:

    =IFERROR(IF(AND(AR3=""),"",IF(AND(AR3<>"",OR(AW3={"Plug","bolt","studs","EXPMETAL"})),AR3*CG3,IF(AND(AR3<>"",OR(AW3={"Angle","Bar","WF","Channel","Hss","Pipe","Plate"})),CD3*CG3,IF(AND(AR3<>"",OR(AW3={"REBAR","ALLTHRD"})),BQ3*CG3,IF(AND(AR3<>"",OR(AW3={"decking","grating","expmetal"})),BY3*CG3,""))))),"")

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: =IF( Question - Tough one, pretty convoluted

    OK just saw a logic error in the 1st part. You cannot use AND, you need to use OR.
    AND(AR3="",AR3<0
    AR3 cannot be both "" AND <0, so maybe...
    =IF(OR(AR3="",AR3<0...
    then (and I think you picked up on this), do you really need to test for ,CD3="",CG3=""?
    If not, then perhaps...
    =IF(OR(AR3="",AR3<0),"",
    IF(AR3>0,
    IF(AW3={"Plug","bolt","studs","EXPMETAL"},AR3*CG3,
    IF(AW3={"Angle","Bar","WF","Channel","Hss","Pipe","Plate"},CD3*CG3,
    IF(AW3={"REBAR","ALLTHRD"},BQ3*CG3,IF(AW3={"decking","grating","expmetal"},BY3*CG3,""))))))

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: =IF( Question - Tough one, pretty convoluted

    With complex formulas like that, I like to try and keep things "paragraphed" to make the logic easier to see. To do this, use ALT ENTER where you want to start a new line

+ 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. How to replace VLOOKUP formulas with values across entire workbook
    By pchurch in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2012, 05:45 PM
  2. tough question for the best of the best
    By rlandis67 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2008, 10:55 PM
  3. tough spreadsheet question
    By mufan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-08-2008, 03:33 PM
  4. *Tough Math Question*
    By Spreadsheet in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-06-2006, 12:51 PM
  5. Tough Formula Question
    By shelfish in forum Excel General
    Replies: 6
    Last Post: 05-29-2006, 01:35 PM
  6. Tough question
    By SHAETY in forum Excel General
    Replies: 8
    Last Post: 02-17-2006, 12:35 AM
  7. Pretty simple question
    By Alex in forum Excel General
    Replies: 3
    Last Post: 07-26-2005, 08:05 AM
  8. [SOLVED] Tough Macro Question
    By Chris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2005, 01:06 PM

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