#1
|
|||
|
|||
Sum specific entries in column that are greater than zero
Hi everyone. I hope you can help me.
I have a number of columns with sales revenue in each column. Column C has values of sales which a percentage is paid as commission and I have used the following formula to count the number of sales in this column; =COUNTIF(C2:C33,"<>"&"") The first 10 sales are calculated at 10%, the second are at 15% and all sales greater than 21 are calculated at 20%. However, not all sales include ITEM C, so I require a formula please that can do the following; IF(C34<11, then sum of the first 10 entries that are greater than 0) and multiply by 10%, IF(C34 is between 11 and 21, then sum the first 10 entries that are greater than zero and multiply by 10% plus sum the second 10 entries that are greater than zero and multiply by 15%, IF (C34 >20, then sum the first 10 entries that are greater than zero and multiply by 10% plus sum the second 10 entries that are greater than zero and multiply by 15% and sum the rest of the entries that are greater than zero and multiply by 20%. Sorry if I haven't explained it better, but my brain is really fried with this one. Example.xlsx |
#2
|
||||
|
||||
I too found it difficult to get a worksheet formula that was easy to maintain and in the end gave up and wrote a user-defined function to do it instead.
In the attached, I've worked out what I think the answer should be in cell E34 as a cross-check. You use the function as follows, (see cell F34): =Commission(C2:C33) It counts numbers from the top (if there's a zero it calls that a sale for counting purposes, but blanks and text are not counted). You can use it in a different way, to include multiple non-contiguous areas like: =Commission((C2:C9,C12:C16,C19:C27,C29:C31)) Two things to note here: 1. You need the double parenthesesTo show you the importance of these 2 points see cells H34:I34 which process the same cells but return different values. Also see M9:M11. There's a comment in the code for the function syaing you can add more threholds, for example you could change it to: Code:
Thresholds = Array(0, 11, 26,101) CommRates = Array(0, 0.1, 0.15, 0.5) As an aside, your formula for counting sales in cell C34 is dangerous because it counts cells containing anything at all, including text. I put text in cell C3 to demonstrate and a simpler and more reliable formula for this in cell C35. All academic since it's not used to calculate the commission. |
#3
|
||||
|
||||
Very nice, p45cal
Quote:
Count the number of numerical entries between the adjoining Col C cell and C2; Multiply the Col C value by .1, .15 or .2 accordingly. Won't that work, and be easy enough? |
#4
|
||||
|
||||
Quote:
I thought the OP was looking for a single-cell formula. |
#5
|
|||
|
|||
As usual, the people on this forum are amazing and absolute geniuses. Thank you for your help. It has been a few years since I have asked for help.
In an ever- changing self focused world, its really nice to see that the qualities of the people in this forum has not changed. Thank you again |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Count # of times "text" is in 1 column is specific date is in the other column | ann.acornacchio | Excel | 4 | 12-31-2016 05:40 PM |
Want to copy all rows that contain a specific value in column B | mcronin | Excel Programming | 3 | 06-15-2016 09:44 AM |
Copy column entries on value | Guloluseus | Excel | 3 | 01-05-2015 08:28 PM |
Greater than today at a specific time | cangelis | Excel | 6 | 10-01-2014 08:48 AM |
Creating Calendar Entries using Specific Times | ndd811818 | Outlook | 0 | 03-04-2013 10:56 AM |