+ Reply to Thread
Results 1 to 16 of 16

Complicated IF function

Hybrid View

maidenhel Complicated IF function 01-13-2014, 05:05 PM
Steveapa Re: Complicated IF function 01-13-2014, 05:09 PM
Steveapa Re: Complicated IF function 01-13-2014, 05:18 PM
FDibbins Re: Complicated IF function 01-13-2014, 05:27 PM
maidenhel Re: Complicated IF function 01-13-2014, 05:35 PM
FDibbins Re: Complicated IF function 01-13-2014, 05:22 PM
bebo021999 Re: Complicated IF function 01-14-2014, 12:17 PM
FDibbins Re: Complicated IF function 01-14-2014, 12:50 PM
maidenhel Re: Complicated IF function 01-14-2014, 01:49 PM
maidenhel Re: Complicated IF function 02-07-2014, 02:15 PM
bebo021999 Re: Complicated IF function 02-08-2014, 11:34 AM
maidenhel Re: Complicated IF function 02-10-2014, 11:20 AM
ukmikeb Re: Complicated IF function 02-10-2014, 11:54 AM
arlu1201 Re: Complicated IF function 02-11-2014, 05:16 AM
  1. #1
    Registered User
    Join Date
    01-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Question Complicated IF function

    Hello All,

    I am new to this site in hopes of a little help.

    Here's the quick scenario:

    I have 2 columns that I would like to compare. They start at F4 and G4 respectively. Here's what I am trying to achieve:

    IF
    F4>0, G4>0 display NO PITCH
    F4=0, G4>0 display GAS
    F4>0, G4=0 display ELECTRIC
    F4=0, G4=0 display DUAL

    I have tried tirelessly to get the result column to display correctly, to no avail.

    As another challenge, I would like this result to be compared to an additional column, call it E4. There are 3 results in E4, COMBINE, E-RES, G-RES. COMBINE has no effect on the result. E-RES would negate GAS, and turn DUAL into ELECTRIC. G-RES would negate ELECTRIC, and turn DUAL into GAS.

    If this second part could be integrated as well, it would so greatly appreciated, but I understand it complicates things quite a bit.

    Thank you in advance!

  2. #2
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Harrisburg, PA
    MS-Off Ver
    Office 365 MSO (16.0.10730.20264) 32-bit
    Posts
    166

    Re: Complicated IF function

    you need to do something like if(and(f4>0,G4>0),"No Pitch",if(and(f4=0,g4>0,"Gas"),if(and(F4>0,G4=0),"Electric",if(and(f4=0,G4=0)),"Dual","Something else")))))
    Also, you can add E4 to the and function

    Have fun

  3. #3
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Harrisburg, PA
    MS-Off Ver
    Office 365 MSO (16.0.10730.20264) 32-bit
    Posts
    166

    Re: Complicated IF function

    You could also use hidden columns. One column for each comparison. Say, H4 = If(And(F4=0,G4>0),"Gas","")... J4 = If(And(F4>0,G4>0),"Electric","") etc. Do a new column for each comparison. Then, the last column you could concatenate all the test columns to get the final answer. K4=H4 & J4. 'H4 & J4' is the same as =CONCATENATE(H4,J4). Since all but one will be Null, it will only show what you want. Hide all columns for each comparison.

  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
    53,048

    Re: Complicated IF function

    for the 2nd part...
    Im not exactly sure what you mean by "negate" Perhaps it would be easier if you provided a few samples, with expected outcome?
    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

  5. #5
    Registered User
    Join Date
    01-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Complicated IF function

    thank you guys so much for the quick replies!

    so far i've used this: =IF(AND(F4>0,G4>0),"NO PITCH",IF(AND(F4=0,G4>0),"GAS",IF(AND(F4>0,G4=0),"ELECTRIC",IF(AND(F4=0,G4=0),"DUAL"))))

    it worked like a charm.

    for the 2nd part, i shouldn't have used the word "negate". basically, if the value in E4 equals E-RES, then i want the result column from above to read "ELECTRIC" regardless of the F4 and G4 formulas. so it would override the other result. G-RES would display "GAS". most of the values in column E are 'COMBINE', which won't effect the result column.

    does this clarify enough?

  6. #6
    Registered User
    Join Date
    01-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Complicated IF function

    what if i simplified the 2nd part to simply be:

    IF
    E4=E-RES,G4>0, "NO PITCH"
    E4=G-RES,F4.0, "NO PITCH"

    i tried adding these to what i've used so far =IF(AND(F4>0,G4>0),"NO PITCH",IF(AND(F4=0,G4>0),"GAS",IF(AND(F4>0,G4=0),"ELECTRIC",IF(AND(F4=0,G4=0),"DUAL"))))
    and i keep getting errors.

    this is exactly what i've input:
    =IF(AND(F4>0,G4>0),"NO PITCH",IF(AND(F4=0,G4>0),"GAS",IF(AND(F4>0,G4=0),"ELECTRIC",IF(AND(F4=0,G4=0),"DUAL",IF(AND(E4=E-RES,G4>0,"NO PITCH",IF(AND(E4=G-RES,F4>0,"NO PITCH"))))))))

    can you guys troubleshoot this for me? am i doing something wrong?

  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
    53,048

    Re: Complicated IF function

    Hi and welcome to the forum

    Maybe something like this?

    =if(F4>0,if(G4>0,"No Pitch","Electric"),if(G4>0,"Gas",Dual"))

  8. #8
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,645

    Re: Complicated IF function

    So E4 must be considered first, then F4 and G4 next:
    =IF(E4="E-RES","ELECTRIC",IF(E4="G-RES","GAS",IF(F4>0,IF(G4>0,"No Pitch","Electric"),IF(G4>0,"Gas","Dual"))))
    Quang PT

  9. #9
    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
    53,048

    Re: Complicated IF function

    Steve, I edited your post to show you how to post the "use code tags" bit. Doing it the way you did, it thinks you are actually posting code. Edit your post to see how I did it, it uses the [noparse command

  10. #10
    Registered User
    Join Date
    01-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Complicated IF function

    thanks again for your all of your help! what a great "welcome to the forum". i added reputation and marked this thread as SOLVED.

  11. #11
    Registered User
    Join Date
    01-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Complicated IF function

    so i'm back because i don't think i have my problem resolved just yet. i am using this function: =IF(E718="E-RES","ELECTRIC",IF(E718="G-RES","GAS",IF(F718>0,IF(G718>0,"NO PITCH","ELECTRIC"),IF(G718>0,"GAS","DUAL"))))

    here's the issue i am still having. hopefully this image shows up:

    Untitled.png

    so basically, i want H718 to display "NO PITCH" because E718=E-RES **AND** G718>0. The same would apply if E718="G-RES" **AND** F718>0.

    can anyone tell from my function where i am going wrong? or what i might need to add? i've been playing around with this forever and i've come up empty-handed, so any help would be amazing.
    Attached Images Attached Images

  12. #12
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,645

    Re: Complicated IF function

    How about:
    =IF(E718="E-RES",IF(G718>0,"NO PITCH","ELECTRIC"),IF(E718="G-RES",IF(F718>0,"NO PITCH","GAS"),IF(F718>0,IF(G718>0,"NO PITCH","ELECTRIC"),IF(G718>0,"GAS","DUAL"))))

  13. #13
    Registered User
    Join Date
    01-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Complicated IF function

    you're a genius! worked like a charm. thank you so much!

  14. #14
    Registered User
    Join Date
    04-20-2013
    Location
    Woking, England
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    34

    Re: Complicated IF function

    Hi

    Please note that this question was also posted here :-
    http://www.mrexcel.com/forum/excel-q...-function.html

    While it is apparent that the OP is a new poster, he/she should make him/herself aware of Forum Rules regarding posts on other sites, and mentioning within the thread that there is a post on another site.
    Mike

  15. #15
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Complicated IF function

    Thanks ukmikeb.

    Maidenhel,

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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. Complicated IF function with example
    By ruthyeh in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-21-2013, 06:40 PM
  2. Complicated IF function
    By ruthyeh in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-21-2013, 10:59 AM
  3. Help with a complicated IF function
    By este994 in forum Excel General
    Replies: 17
    Last Post: 04-20-2011, 07:10 AM
  4. A Complicated Look up Function?
    By screamnyak in forum Excel General
    Replies: 2
    Last Post: 02-24-2011, 01:01 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