Declaring variables in Excel Cells

后端 未结 4 422
有刺的猬
有刺的猬 2020-12-13 03:19

Is it possible to declare variables in Excel cells and use them as parameters for formulas in other cells?

For example I would declare var1=10 in one o

相关标签:
4条回答
  • 2020-12-13 03:58

    You can name cells. This is done by clicking the Name Box (that thing next to the formula bar which says "A1" for example) and typing a name, such as, "myvar". Now you can use that name instead of the cell reference:

    = myvar*25
    
    0 讨论(0)
  • I also just found out how to do this with the Excel Name Manager (Formulas > Defined Names Section > Name Manager).

    You can define a variable that doesn't have to "live" within a cell and then you can use it in formulas.

    Excel Name Manager

    0 讨论(0)
  • 2020-12-13 04:23

    You can use (hidden) cells as variables. E.g., you could hide Column C, set C1 to

    =20
    

    and use it as

    =c1*20
    

    Alternatively you can write VBA Macros which set and read a global variable.

    Edit: AKX renders my Answer partially incorrect. I had no idea you could name cells in Excel.

    0 讨论(0)
  • 2020-12-13 04:25

    The lingo in excel is different, you don't "declare variables", you "name" cells or arrays.

    A good overview of how you do that is below: http://office.microsoft.com/en-001/excel-help/define-and-use-names-in-formulas-HA010342417.aspx

    0 讨论(0)
提交回复
热议问题