zoukankan      html  css  js  c++  java
  • How to create a dynamic range source(转) Anny

    Refer to http://www.contextures.com/xlDataVal05.html

    Refer to http://www.mrexcel.com/forum/excel-questions/188444-auto-increment-source-range-drop-down-list-box.html

    One way is to define a 'Dynamic' named range via insert/name/define and use a formula like this instead of a cell reference. The range will then accomodate additions. Mustn't include blank cells or have anything else in the column though. This starts at cell A1 using column A.
    = OFFSET(Mysheet!$A$1,0,0,COUNTA(Mysheet!$A:$A),1)

    1. Create and save a workbook (MyLists.xls, in this example)

    2. Enter a list of names in cells A1:A2 on Sheet 1.

    3. To create a dynamic range, choose Insert|Name|Define(or Formulas|Name Manager|)

    4. Use Employees as the range name, and the following formula: =OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1)

    5. In another sheet, in one cell, choose Data|Data Validation|Allow List, and source: =Employees   (Note: Please donot forget =), and click OK

    PS:

    =OFFSET function:

    Returns a reference to a range that is a specified number of rows and columns from a cell or range of cells. The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and the number of columns to be returned.

    Syntax

    OFFSET(reference, rows, cols, [height], [width])

    The OFFSET function syntax has the following arguments (argument: A value that provides information to an action, an event, a method, a property, a function, or a procedure.):

    • Reference Required. The reference from which you want to base the offset. Reference must refer to a cell or range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value.
    • Rows Required. The number of rows, up or down, that you want the upper-left cell to refer to. Using 5 as the rows argument specifies that the upper-left cell in the reference is five rows below reference. Rows can be positive (which means below the starting reference) or negative (which means above the starting reference).
    • Cols Required. The number of columns, to the left or right, that you want the upper-left cell of the result to refer to. Using 5 as the cols argument specifies that the upper-left cell in the reference is five columns to the right of reference. Cols can be positive (which means to the right of the starting reference) or negative (which means to the left of the starting reference).
    • Height Optional. The height, in number of rows, that you want the returned reference to be. Height must be a positive number.
    • Width Optional. The width, in number of columns, that you want the returned reference to be. Width must be a positive number.

    =COUNTA function:

    The Excel Counta function returns a count of non-blanks within a supplied set of cells or values.

    The function is commonly used to return the number of non-blank cells in a range. However, as well as ranges of cells, the Counta function can directly received arrays of values, which are not stored in cells.

    COUNTA( value1, [value2], ... )

    Where the arguments, value1, [value2], etc, can be any values or references to cell ranges.

  • 相关阅读:
    js,JavaScript,a标签onclick传递参数不对,A标签调用js函数写法总结
    Java两大测试方法Junit和TestNG的比较
    java简单的测试方法执行了多少时间
    利用Chrome的Performance工具排查页面性能问题(原叫timeline)
    P3317 [SDOI2014]重建(Matrix-tree+期望)
    P2221 [HAOI2012]高速公路(线段树)
    P2473 [SCOI2008]奖励关(期望)
    P3302 [SDOI2013]森林(主席树+启发式合并)
    bzoj3932 / P3168 [CQOI2015]任务查询系统(主席树+差分)
    P2219 [HAOI2007]修筑绿化带(单调队列)
  • 原文地址:https://www.cnblogs.com/limei/p/2860467.html
Copyright © 2011-2022 走看看