简体   繁体   中英

Tally data from 1 sheet conditionally to variable rows of another based on a value in source row

I'm trying to solve an Excel issue: I have a table of data in 1 sheet, with several columns of values. One of those columns is an identifier value, calculated by a function applied to some of the other values in that row (ie. If a3/b3>5 but < 10, then the identifier value for row 3= 18, if a3/b3=10, then ID value =22, etc), each row has an ID that can = anything from 1-120. This number corresponds directly to a row in the target sheet, so target sheet has 120 rows with the same columns matching the data columns of the source

What I need to do is take the data from the source sheet and add it incrementally to the corresponding columns in the target sheet, so there is a running accumulating tally- but tally the data from the source rows into the target rows that have the same ID- so for example, all source sheet rows that have ID value of 47 have their data tallied only into the various columns in row 47 of the target sheet, and so on- so all data in the source gets tallied, but only into one row of the target, determined by the source row's ID value. The source sheet will grow over time with more rows of data, resulting with ever increasing values in the target sheet that will always have exactly 120 rows.

I'm a not an experienced coder, good enough to google how to do what I need to do and figure it out usually, but this one is a little more complex than what I've done before

Edited to add example: 在此处输入图像描述

So in the example above, in the source sheet, an ID value of 12 appears for 4 of the visible rows. What I need is for that to result with the target sheet's row that has an ID value of 12, (target sheet row 17) to have it's columns show the aggregate total of values for the corresponding cells in all the source sheet's rows that have ID=12. So in this case, target sheet row 17 "Bonus" cell should = 0, "No Bonus" should = 4, "No Multiplier" should equal 2, "2x Multiplier" should = 1, etc.

This should apply for all data in the source doc, so each source row will have its values added to the tally of one specific target row, defined by a match of ID value

I saw the edit earlier adding the VBA tag, I'm unfamiliar with using that, but can probably figure it out if necessary with a little guidance:)

I misunderstood the question completely at first, but with the given data please try: =SUM(IF(SourceSheet:$B$2,$B$13=TargetSheet:$M6,IF(SourceSheet:$C$1:$H$1=TargetSheet!N$5,SourceSheet!$C$2:$H$13))) Paste this in Target sheet cell N6 with ctrl + shift + enter and drag down/right. You need to change the Sheet names to the actual sheet names and the range to the actual range.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM