+ Reply to Thread
Results 1 to 4 of 4

AND - Unsure how to use it

  1. #1
    Registered User
    Join Date
    08-13-2009
    Location
    Alberta
    MS-Off Ver
    Excel 2007
    Posts
    8

    AND - Unsure how to use it

    Hello All...I am sure this is an easy one:

    I would like to check a combination of two cells, if these two cells are both empty (not zero, just blank) then it will return a blank in another cell.

    I tried using AND but am unsure how it works. I would like to use a "Case" Function.

    Function FirstCheck(Count1, Count2)

    Select Case FirstCheck
    Case Count1 = "", Count2 = ""
    FirstCheck = ""
    Case Else
    FirstCheck = Abs((Count1 - Count2) / (Count1 + Count2))
    End Select

    End Function

    Thanks
    Last edited by Strathcona; 08-18-2009 at 05:53 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: AND - Unsure how to use it

    Maybe like this:
    Please Login or Register  to view this content.
    The function then used in a cell as =FIRSTCHECK(A2,B2)

    Be sure to put code tags around your code samples, it's a forum requirement. You should edit your first post to correct that.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-13-2009
    Location
    Alberta
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: AND - Unsure how to use it

    Ok...I got it for anyone interested

    Function FirstCheck(Count1, Count2)

    If Count1 = "" And Count2 = "" Then
    FirstCheck = ""
    Else
    x = Count2 / Count1
    If x <= 1 Then
    x = x ^ (-1)
    End If
    FirstCheck = Abs(1 - x)
    End If
    End Function

  4. #4
    Registered User
    Join Date
    08-13-2009
    Location
    Alberta
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: AND - Unsure how to use it

    Thanks you, this one really wasn't too tricky and I figured it out fairly soon after posting. Thank you anyways of course! You are wonderful.

+ 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