活动单元格作为公式的输入 [英] Active cell as input to formula

查看:135
本文介绍了活动单元格作为公式的输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我是否可以使用活动单元格,我的意思是在给定时间后,在方格边框上点击该按钮之后,将其作为参数中的高亮显示单元格。 p>

例如,我创建了一个加权平均值为3个权重的表:w1在列标题中(请参见下面的文件),行标题中的w2,以及w3,它补充了w1和w2到1。



我想做的是让表外的单元格显示平均值在表中的单元格时的权重选择。



例如:
截图: http: //imgur.com/emmBH5S/



文件可以在这里找到: https://drive.google.com/file/d/0B_7-00fdslR7Tm11ODRVS296ckk/



这里我们看到单元格K12是活动的,
,K12 w1 = 0.2,w2 = 0.15,因此,以上(第3-4行)的权重表根据活动单元格中的权重获取适当的值。
(当然我手动创建这个为了说明的目的)



有没有办法呢?最好没有VBA
找不到任何非常有用的东西...



提前感谢!
A

解决方案

您不需要VBA(尽管您可能更喜欢)。

  W1:= INDEX($ F $ 8:$ AA $ 29,1,MAX(COLUMN(INDIRECT(CELL(address))) - (COLUMN (F8)-1),1))
W2:= INDEX($ F $ 8:$ AA $ 29,MAX(ROW(INDIRECT(CELL(address))) - (ROW(F8)-1) ,1),1)
W3:= J4-(G4 + H4)

CELL 函数与地址参数返回无论哪个单元格处于活动状态的地址。我使用 INDIRECT 将该地址(只是一个字符串)转换为单元格引用。然后我使用

  = INDEX(范围,1,参考列)
/ pre>

获取w1值 - 第一行中的值和与活动单元格相同的列。该公式不在乎您的活动细胞,所以我在这里卡住了一个 MAX ,如果超出范围,它将返回一个零。



请注意,只需选择一个单元格就不会触发更改。选择一个单元格后,按F9键来计算单张以获得正确的结果。


I was wondering if I can use the active cell, by that I mean the cell that is "highlighted" at a given time with the square border after there was a mouse click there, as an argument in a function.

For example, I have created a table with weighted averages with 3 weights: w1 is given in the column headers (kindly see the file below), w2 in the row headers, and w3 which complements w1 and w2 to 1.

What I'd like to do is have cells outside the table show the weights the average got when a cell in the table is selected.

For example: Screenshot: http://imgur.com/emmBH5S/

file can be found here: https://drive.google.com/file/d/0B_7-00fdslR7Tm11ODRVS296ckk/

Here we see the cell K12 is active, and for K12 w1=0.2, w2=0.15, and so, the cells in the weights tables above (rows 3-4) get the appropriate values according to the weights in the active cell. (of course I manually created this one for illustration purposes)

Is there a way to do that? Preferably without VBA if possible Couldn't find anything very useful...

Thanks in advance! A

解决方案

You don't need VBA (although you may prefer it).

W1: =INDEX($F$8:$AA$29,1,MAX(COLUMN(INDIRECT(CELL("address")))-(COLUMN(F8)-1),1))
W2: =INDEX($F$8:$AA$29,MAX(ROW(INDIRECT(CELL("address")))-(ROW(F8)-1),1),1)
W3: =J4-(G4+H4)

The CELL function with the address argument returns the address for whichever cell is active. I use INDIRECT to convert that address (just a string) to a cell reference. Then I use

=INDEX(Range, 1, Column of Reference)

to get the w1 value - the value in the first row and the same column as the active cell. The formula doesn't care what cell you make active, so I stuck a MAX in there so it would return a zero if you're out of the range.

Note that simply selecting a cell won't trigger the change. Once you select a cell, press F9 to calculate the sheet to get the proper results.

这篇关于活动单元格作为公式的输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆