从另一列的最大值中找到一个列中的值 [英] Find the value in One column from the max val of the other column

查看:81
本文介绍了从另一列的最大值中找到一个列中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我在VBA脚本中遇到一个问题.

我想为以下问题开发一个宏

我有两列不知道行数...每列都包含一些数字.
假设A1:A10也有年龄值B1:B10也有各自的体重值

在A11上,我想找到A1:A10的最大值,在B11上,它应该显示相应的权重值MAX(A1:A10).
例如,我在这里提到A1:A10,但在实际数据中我不知道行数.

有什么可以帮我的忙吗...以及EXECElsheet

Hello,

i am struck with one problem in VBA script.

i want to develop a macro for my following problem

i have two columns dont know the no of rows... each column contains some numbers.
Suppose A1:A10 there age values similarly B1:B10 there are respective weight values

on A11 i want to find the max of A1:A10 and At B11 it should display corresponding weight value of MAX(A1:A10)..

here A1:A10 i mentioned for example but in real data i dont know no of rows.

Can any help out me on this... along with the what is the formula use for EXECElsheet

推荐答案

使用的公式是什么?找出引用等的好方法是记录一个工作簿中的宏,然后查看完成的宏以找到解决问题所需的命令.例如,在下面的宏中,我在A列的前四行中具有值.从A1开始,我使用< End>< down>要移至最后一行,请向下移动1并输入最大公式.生成的宏为:

A good way of figuring out references etc. is to record a macro in the workbook and then look at the completed macro to find the commands required to solve the problem. For example in the following macro I had values in the first four rows of column A. Starting from A1 I used <End><down> to get to the last row, moved down 1 and entered the max formula. The resulting macro is:

Sub Macro1()
'
' Macro1 Macro
'
    Selection.End(xlDown).Select
    Range("A5").Select
    ActiveCell.FormulaR1C1 = "=MAX(R[-4]C:R[-1]C)"
    Range("A6").Select
End Sub


进行一些试验应该有助于弄清楚如何在任何情况下都能正常工作.


A little experimentation should help to figure out how to make that work for any case.


这篇关于从另一列的最大值中找到一个列中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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