简体   繁体   中英

I need help finding a formula to format my Excel database

图片

Excel doesn't count my records like I want it to. I have been trying for a while now.

Example

School        6
Work          5
TV            3
School        2

I have a formula that counts the numbers, so I have a total now. which is 16. What I want is to have a formula that counts the hours for each term

So when I write

School
Tv 
Work

I want to get the hours for each of these.

So instead of counting the number of "school" that is in the document, I want it to calculate ALL numbers even if school is in there like 10 times.

In this case my expected output would be

School 8
TV     3
Work   5 

I've been searching for the formula to do this...

So I'll try to explain again: I have 2 fields, one containing terms the other containing numbers. I need a formula that counts the sum of numbers for each term in the fields with terms. EVEN IF the term is in there twice than it is supposed to count the values and add it up to each other... By doing this I will be able to create a graphic.

UPDATE

Maybe the picture will help understanding it better

You don't want to count, you want to sum. Assuming the text in your screenshot "FORMULA HERE" is in cell K3, you can use

=Sumifs(B:B,C:C,J3)

in words: Sum all values from column B where the text in column C is the same as the text in J3. Adjust the column and cell references to suit your scenario.

Copy the formula down.

Analysis like this can also be done with pivot tables, without having to write any formulas.

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