+ Reply to Thread
Results 1 to 10 of 10

If or And, blanks and formula help

Hybrid View

  1. #1
    Registered User
    Join Date
    05-10-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    If or And, blanks and formula help

    If H10 is blank= 0
    if H10 contains “mini” but H11 is blank =400
    If H10 contains “mini” and H11 contains “split” = 200
    Last edited by JMarie77; 05-10-2013 at 01:21 PM.

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

    Re: HELP! I'm kinda lame with Excel and I need to know how to write this...

    Hi and welcome to the forum

    We would love to help you with your question, but 1st, in accordance with forum rules, please rename your thread to something more meaningful, that actually describes your problem.

    Because thread titles are used in searching the forum it is vital they be written to accurately describe your thread content or overall objective using ONLY search friendly key words. That is, your title used as search terms would return relevant results.

    Many members will look at a thread title, and if it is of interest to them, or it falls within their area of expertise, they might only open those threads.

    Look at it this way...if you typed that title into google, what would you expect to get back?
    To change a Title on your post, click EDIT on you're 1st post, then Go Advanced and change your title
    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
    05-10-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: HELP! I'm kinda lame with Excel and I need to know how to write this...

    Thank you for the tip.

  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: If or And, blanks and formula help

    Thanks

    If H10 is blank= 0
    if H10 contains “mini” but H11 is blank =400
    If H10 contains “mini” and H11 contains “split” = 200
    =IF(H10="",0,IF(AND(H10="mini",H11=""),400,IF(AND(H10="mini",H11="split"),200)))

  5. #5
    Registered User
    Join Date
    05-10-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: If or And, blanks and formula help

    Sorry, it's returning 0, not 400

  6. #6
    Registered User
    Join Date
    05-10-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: If or And, blanks and formula help

    ok, sorry, there were some cell numbers that needed to be changed, as it wasn't h10 / h11, but h10 and i10. that was my bad. your formula worked perfectly, after I tweaked my own bad info. You're the best and saved my day. THANK YOU SOOOO MUCH!!!!!

  7. #7
    Registered User
    Join Date
    05-10-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: If or And, blanks and formula help

    FDibbins,

    Thank you for your help, however, I plugged that in and it's returning 400 for me no matter what.

    J

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

    Re: If or And, blanks and formula help

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  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: If or And, blanks and formula help

    Happy to help

  10. #10
    Registered User
    Join Date
    12-18-2012
    Location
    Houston TX
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: If or And, blanks and formula help

    Personally, I find IF statements which are nested > 2 level to be hard to code, to understand, to debug, and to maintain. May I suggest a macro?
    Public Function MiniSplit(C1 As Range, C2 As Range) As Long
        If C1.Value = "" Then
            MiniSplit = 0
        ElseIf C1.Value = "mini" And C2.Value = "split" Then
            MiniSplit = 400
        ElseIf C1.Value = "mini" And C2.Value = "" Then
            MiniSplit = 200
        Else
            MiniSplit = -1
        End If
    End Function
    seems to work. In the calling cell, put "=MiniSplit(H10, H11)"

    I've understood you to mean that H10 either holds "mini" or is blank. If you are trying to pattern-match (e.g if H10 holds "minimum") or are not wanting to be case sensitive, then you can tell us that.

    You might get cleaner code using a SELECT statement instead of IF/ELSEIF, depending on what all you're trying to do.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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