1fy07h 发表于 2024-10-1 07:56:08

根据下拉列表按钮,实现动态累计求和!


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">1</span><span style="color: black;"><span style="color: black;">职场实例</span></span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">小伙伴们<span style="color: black;">大众</span>好</span></span></strong><span style="color: black;">,今天<span style="color: black;">咱们</span>来<span style="color: black;">处理</span>一个公众号后台粉丝留言咨询的</span><strong style="color: blue;"><span style="color: black;">Excel职场案例</span></strong><span style="color: black;">:</span><strong style="color: blue;"><span style="color: black;"><span style="color: black;">怎样</span><span style="color: black;">经过</span>下拉列表<span style="color: black;">选取</span><span style="color: black;">区别</span>的截止月份,实现对<span style="color: black;">制品</span>产量的动态累计求和</span></strong>,这个问题<span style="color: black;">触及</span>到多个<strong style="color: blue;"><span style="color: black;"><span style="color: black;">基本</span>的<span style="color: black;">平常</span>的</span></strong>,<strong style="color: blue;"><span style="color: black;">必学必会的</span></strong>Excel技巧,<span style="color: black;">因此</span><span style="color: black;">博主</span>整理好了思路分享给<span style="color: black;">大众</span>,以备不时之需。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">如下图所示</span></span></strong><span style="color: black;">:</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">A2:F5为一张<span style="color: black;">各样</span><span style="color: black;">果蔬</span><span style="color: black;">区别</span>月份的产量二维明细报表,<span style="color: black;">咱们</span>想要<span style="color: black;">经过</span>在F2单元格的下拉列表中获取<span style="color: black;">区别</span>的截止月份,实现对<span style="color: black;">果蔬</span>的产量按月累计汇总求和。<span style="color: black;">例如</span>说<span style="color: black;">咱们</span>以“苹果”为例,当F2单元格切换到1月时,即截止到1月的累计产量为100;当F2单元格切换到2月时,即截止到2月的累计产量为100+200=300,以此类推。</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-axegupay5k/bfbd5c3d657c4b90bafd38ab198da066~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1727949084&amp;x-signature=4AF2GZeesdw7a9zmfjUxX3CGWX8%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">2</span><span style="color: black;"><span style="color: black;">解题思路</span></span></span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">处理</span>这种动态的累计求和问题,<span style="color: black;">咱们</span>需要用到<span style="color: black;">基本</span>的数据验证(数据有效性)功能,还需要用到<span style="color: black;">基本</span>的Match函数、Offset函数和Sum函数。下面<span style="color: black;">咱们</span>就来看一下<span style="color: black;">详细</span>操作<span style="color: black;">办法</span>。</h1>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/c9bb2676b5454437982bbdbb9fd48c4f~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1727949084&amp;x-signature=Acs%2FyJ07t9jSyWbdSgOuXAEQm90%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;"><span style="color: black;">首要</span><span style="color: black;">咱们</span>需要利用数据验证功能制作下拉列表</span></span></strong><span style="color: black;">。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">选中F2单元格,点击【</span><strong style="color: blue;"><span style="color: black;">数据-数据验证</span></strong><span style="color: black;">】,在弹出的【</span><strong style="color: blue;"><span style="color: black;">数据验证</span></strong><span style="color: black;">】的功能面板中,将【</span><strong style="color: blue;"><span style="color: black;"><span style="color: black;">准许</span></span></strong><span style="color: black;">】设置为【</span><strong style="color: blue;"><span style="color: black;">序列</span></strong><span style="color: black;">】,在【</span><strong style="color: blue;"><span style="color: black;"><span style="color: black;">源自</span></span></strong><span style="color: black;">】处,框选区域:</span><strong style="color: blue;"><span style="color: black;">B2:E2</span></strong><span style="color: black;">,最后点击【</span><strong style="color: blue;"><span style="color: black;">确定</span></strong><span style="color: black;">】按钮后<span style="color: black;">就可</span>完成下拉列表的设置,</span><strong style="color: blue;"><span style="color: black;"><span style="color: black;">详细</span>操作过程如下图所示</span></strong><span style="color: black;">:</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/dec9820ee075400792c85b8e34a38213~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1727949084&amp;x-signature=3pfWru4eD4g4wQnVzP2Uo9xKrgM%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">咱们</span>在F3单元格输入函数公式</span></strong><span style="color: black;">:</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">=MATCH($F$2,$B$2:$E$2,0)</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">MATCH函数</span></strong><span style="color: black;">返回指定的值在指定数组中的相对位置。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">基本语法结构</span></strong><span style="color: black;">:</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">=Match(<span style="color: black;">查询</span>值,<span style="color: black;">查询</span>范围,[匹配模式])</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">匹配模式有-1、0、1三种,分别为:大于、<span style="color: black;">精细</span>匹配、<span style="color: black;">少于</span>。当省略此参数时,默认为<span style="color: black;">精细</span>匹配。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">咱们</span>利用Match函数,<span style="color: black;">查询</span>F2单元格中的“截止月份”数据,获取在B2:E2区域内的相对位置。<span style="color: black;">例如</span>F2单元格中的“2月”,在B2:E2区域内的相对位置为2;<span style="color: black;">例如</span>F2单元格中的“1月”,在B2:E2区域内的相对位置为1。</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p26-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/d1dc2c7e6457466ca7da5855b57cd624~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1727949084&amp;x-signature=IuTktKPMe%2F49Rd2GIAuarR6UaBE%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">咱们</span>继续完善F3单元格中的函数公式为</span></strong><span style="color: black;">:</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">=OFFSET(B3,,,,MATCH($F$2,$B$2:$E$2,0))</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">OFFSET函数</span></strong><span style="color: black;">是以指定的引用为参照系,<span style="color: black;">经过</span>给定的偏移量返回新的引用。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">基本语法结构</span></strong><span style="color: black;">:</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">=offset(参照单元格,偏移至第几行,偏移至第几列,<span style="color: black;">选择</span>几行,<span style="color: black;">选择</span>几列)</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">本例中<span style="color: black;">咱们</span>省略了</span><strong style="color: blue;"><span style="color: black;">OFFSET函数</span></strong><span style="color: black;">的第2、第3、第4个参数,<span style="color: black;">暗示</span>以B3单元格为基准参照单元格,偏移0行,偏移0列,<span style="color: black;">选择</span>0行,<span style="color: black;">选择</span>的列数<span style="color: black;">咱们</span>用上一步的MATCH函数的返回值<span style="color: black;">暗示</span>。获取到一个新的引用区域。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">例如</span>说:当F2单元格切换到“2月”时,MATCH函数的返回值为2,即以B3单元格为基准参照单元格,偏移0行,偏移0列,<span style="color: black;">选择</span>0行,<span style="color: black;">选择</span>2列,返回新的引用,并以数组的方式存储:</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">={100,200}</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">再<span style="color: black;">例如</span>说:当F2单元格切换到“3月”时,MATCH函数的返回值为3,即以B3单元格为基准参照单元格,偏移0行,偏移0列,<span style="color: black;">选择</span>0行,<span style="color: black;">选择</span>3列,返回新的引用,并以数组的方式存储:</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">={100,200,250}</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">至此<span style="color: black;">咱们</span>就实现了:<span style="color: black;">按照</span>F2单元格切换到<span style="color: black;">区别</span>的截止月份后,<span style="color: black;">咱们</span>就得到了对应的数组,并存储了对应的明细月份产量值</span></span></strong><span style="color: black;">。</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/590542a2df0c4c368bdaf3b4601169a3~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1727949084&amp;x-signature=ablABSJ8uexxx7BM50Rrq2T0SkA%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">咱们</span>继续完善F3单元格中的函数公式为</span></strong><span style="color: black;">:</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">=SUM(OFFSET(B3,,,,MATCH($F$2,$B$2:$E$2,0)))</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">最后<span style="color: black;">咱们</span>只需要用</span><strong style="color: blue;"><span style="color: black;">SUM求和函数</span></strong><span style="color: black;">对上一步数组内各元素求和,就<span style="color: black;">能够</span>实现<span style="color: black;">经过</span>下拉列表<span style="color: black;">选取</span><span style="color: black;">区别</span>的截止月份,实现对<span style="color: black;">制品</span>产量的动态累计求和的效果了。</span><strong style="color: blue;"><span style="color: black;">如下图所示</span></strong><span style="color: black;">:</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/fb4925e0dca04e168278593d24601bb1~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1727949084&amp;x-signature=ZCaXNcmRt9YTtF8bIjk1UifmiNg%3D" style="width: 50%; margin-bottom: 20px;"></div>




nykek5i 发表于 2024-10-4 14:29:32

你的见解独到,让我受益匪浅,非常感谢。

b1gc8v 发表于 2024-10-30 11:10:50

我深受你的启发,你的话语是我前进的动力。

7wu1wm0 发表于 前天 07:32

期待与你深入交流,共探知识的无穷魅力。
页: [1]
查看完整版本: 根据下拉列表按钮,实现动态累计求和!