+ Reply to Thread
Results 1 to 3 of 3

Thread: Displaying Formula Acceptible Variables

  1. #1
    Registered User
    Join Date
    01-11-2011
    Location
    Arkansas, USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Post Displaying Formula Acceptible Variables

    Hello All,

    I've been wondering for a while how to display information regarding my formula within the cell. I don't know how to explain it, so I will just show you pictures. The one marked "What I want the formula to look like.bmp" contains text below the formula displaying what the formula can take. The other attachment is the call of my function, which does not have that extra text. Is is possible to make home made formulas display that extra text?

    Here is my code, if it makes a difference. (I know I could have done the same thing with an OR instead of an Elseif...)

    Public Function combine(data1 As Range, data2 As Range) as string
    If data1 <> "" Then ‘ If something is contained within the first cell
    combine = data1 & " - " & data2 ‘ Return the combination
    ElseIf data2 <> "" Then ‘ If something is not in the first cell, but in the second
    combine = data1 & " - " & data2 ‘ Return the combination
    Else ‘ If data is not in anything, return a space
    combine = " "
    End If
    End Function
    Attached Images Attached Images

  2. #2
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,777

    Re: Displaying Formula Acceptible Variables

    Welcome to the forum.

    Why not just use a formula?

          -A- -B- ----C---- ---------------------------D--------------------------
      1   Bob Joe Bob - Joe C1 and down: =A1 & IF(COUNTA(A1,B1)=2, " - ", "") & B1
      2   Bob     Bob                                                              
      3       Joe Joe
    Please take a few minutes to read the forum rules, and then edit your post to add code tags.

    Thanks.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    01-11-2011
    Location
    Arkansas, USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Post Re: Displaying Formula Acceptible Variables

    Quote Originally Posted by shg View Post
    Welcome to the forum.

    Why not just use a formula?

          -A- -B- ----C---- ---------------------------D--------------------------
      1   Bob Joe Bob - Joe C1 and down: =A1 & IF(COUNTA(A1,B1)=2, " - ", "") & B1
      2   Bob     Bob                                                              
      3       Joe Joe
    Please take a few minutes to read the forum rules, and then edit your post to add code tags.

    Thanks.
    I could do this a lot of different ways, the function is just an example. Once I know how to do display the text, I can use it for all of my formulas. So, I don't have a problem getting the solution I need, it is just making it look nice when calling the formula from a cell.

    It wouldn't be too big of a deal, but I'm not the only one useing these formulas. If I pass this off to someone else, they will just see combine, and not know what it takes as parameters...

    Thank you for the timely response though!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0