如何使用3个单元格完成测试 [英] How to use 3 cells to actually complete the test

查看:73
本文介绍了如何使用3个单元格完成测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,所以我确实进行了快速搜索,但是没有找到符合我想要的答案...我感到很简单,这很可怕..:)

Ok, so I did have a quick search but did not find an answer that does what I would like... I have a horrible feeling that it is simple.. :)

我想要单元格D1中的公式,该公式将使用单元格A1,B1和C1来评估B1中所示的测试.这是为了提出问题.

I would like a formula in cell D1 that will use cells A1, B1 and C1 to evaluate the test shown in B1. This is for producing questions.

图片显示了数据和结果.

The picture shows the data and results.

我尝试了indirect()并没有成功,并且& ;,即

I have tried indirect() with no success and &, ie

=A1&B1&C1

推荐答案

您可以在excel VBA中使用Evaluate方法.请注意,我在rng2上使用.Value.这是因为我们要使用单元格的显示值(以用户看起来在单元格处的格式)而不是excel存储在单元格中的基础值(这是.value2给我们的)

You can use the Evaluate method in excel VBA. Note that i'm using .Value on the rng2. This is because we want to use the displayed value of the cell (in the format in which it appears to the user lookins at the cell) rather than the underlying value that excel stores in the cell (which is what .value2 gives us).

Public Function EEE(rng As Range, rng2 As Range, rng3 As Range)
    EEE = Evaluate(rng.Value2 & rng2.Value & rng3.Value2)
End Function

请注意,有一种方法仅使用工作表函数来执行此操作,但是与VBA解决方案相比,它相当复杂.

Note that there is a method of doing it using only worksheet functions, but it rather complicated compared to the VBA solution. An excellent descriptio of the old Evaluate() function and how to use it is given in this article.

这篇关于如何使用3个单元格完成测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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