Ms Excel或VBA中借贷分录的匹配

Ms Excel或VBA中借贷分录的匹配,excel,vba,Excel,Vba,我今天针对的一个具体问题是Excel表格中借方和贷方金额的匹配,我们没有通用标准或查找值。我们只有数字 我尝试了很多方法,但都失败了。如果我有一个10和一个-5,-3,-2作为学分,那么我必须手动匹配它。有没有办法让变为零的单元格自动高亮显示?有没有更好的方法 一种方法是使用解算器 • Put your data in A1:A12 • In B13, put a formula =SUMPRODUCT(A1:A12,B1:B12) • Set up solver so that B

我今天针对的一个具体问题是Excel表格中借方和贷方金额的匹配,我们没有通用标准或查找值。我们只有数字

我尝试了很多方法,但都失败了。如果我有一个
10
和一个
-5,-3,-2
作为学分,那么我必须手动匹配它。有没有办法让变为零的单元格自动高亮显示?有没有更好的方法


一种方法是使用解算器

•   Put your data in A1:A12
•   In B13, put a formula =SUMPRODUCT(A1:A12,B1:B12)
•   Set up solver so that B1:12 must be binary (ie 1 or 0)
•   In B14 put a "target" score, 100 in your example
•   in B15 put =ABS(B13-B14)
•   Set solver to look for the minimum value in B15 (to either give you an exact solution with no difference, or closest solution with smallest possible difference)
In this case the simplest solution is setting 100 to "on" (ie 1), all other values es "off" (0)
Screenshot for xl2003 for solving for 367 below (as this is more complex than 100)

请通过上传一个示例案例来说明您想要的结果。你的样本不是不言自明的。这是最近被问到的。。。如果没有公共标识符,甚至没有唯一的金额,那么您唯一能做的就是使用条件格式来突出显示零…谢谢。这已经奏效了。谢谢你让我学到了新东西。