Yahoo 知識+ 將於 2021 年 5 月 4 日 (美國東岸時間) 停止服務。從 2021 年 4 月 20 日 (美國東岸時間) 起,Yahoo 知識+ 網站將轉為僅限瀏覽模式。其他 Yahoo 資產或服務,或你的 Yahoo 帳戶將不會有任何變更。你可以在此服務中心網頁進一步了解 Yahoo 知識+ 停止服務的事宜,以及了解如何下載你的資料。

匿名 發問於 電腦及互聯網軟體 · 1 十年前

question about excel function

how can i write a function in excel?

just like the function in excel e.g. =SUM()

can i define the fuction name and the variables?


thx for answering the question, it is also hard for me to define function by myself, but i really want to know how to write a function.

2 個解答

  • 1 十年前

    i am afraid you want to write your own function other than use the built-in function in excel

    for example, suppose you want to find the hypotenuse, a, of a right triangle, which is a=square root of (b^2+c^2), u can: alt+F11, then enter

    Private Function hypo(x As Variant, y As Variant)

    hypo = (x ^ 2 + y ^ 2) ^ (0.5)

    End Function

    go back to you excel and type =hypo(3,4) in any cell, you can see the answer 5

    資料來源: a book' named "absolutely beginner of VBA"
  • 1 十年前

    Actually, the functions can be defined by yourself but it is hard for me. As far as I know, there are enough functions in MS Excel for us to meet daily office work.

    In the MS Excel, you can press INSERT in the menu bar and choose FUNCTION from the pull-down menu. Then you can choose any functions from the pop-up window. The functions are also classified into many categories. I think you must be able to choose one suitable for your work.

    If you are familiar with some specific functions, you can just type it in the cell you specify,

    e.g. =IF(AND(R123<>"", R123<>0),+R123/$F$9,"").

    資料來源: From my knowledge & experience