Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2019, 10:28 PM
skeletor66 skeletor66 is offline Sum specific entries in column that are greater than zero Windows 10 Sum specific entries in column that are greater than zero Office 2013
Novice
Sum specific entries in column that are greater than zero
 
Join Date: Jun 2019
Posts: 3
skeletor66 is on a distinguished road
Default 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
Attached Images
File Type: jpg Capture.JPG (52.4 KB, 28 views)
Reply With Quote
  #2  
Old 07-31-2019, 07:17 AM
p45cal's Avatar
p45cal p45cal is offline Sum specific entries in column that are greater than zero Windows 10 Sum specific entries in column that are greater than zero Office 2016
Expert
 
Join Date: Apr 2014
Posts: 866
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

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 parentheses
2. The order the cells are treated in is the order in which they appear in the inner parentheses. What's more, if any of the areas has a multiple columns the numbers are processed by running down the first column, then the second etc.
To 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)
which would mean zero commision until 10 sales, 10% commission for the 11th to 25th sales, 15% commission for the 26th to the 100th sales, and 50% commision for sales 100 and above.




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.
Attached Files
File Type: xlsm msOfficeForums43080Example.xlsm (17.1 KB, 5 views)
Reply With Quote
  #3  
Old 08-03-2019, 06:00 PM
Lugh's Avatar
Lugh Lugh is offline Sum specific entries in column that are greater than zero Windows 10 Sum specific entries in column that are greater than zero Office 2016
Competent Performer
 
Join Date: May 2019
Location: USA
Posts: 137
Lugh is on a distinguished road
Default

Very nice, p45cal
Quote:
Originally Posted by p45cal View Post
I too found it difficult to get a worksheet formula that was easy to maintain
My first thought—before seeing your answer—was a conditional formula in Col D which would:
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?
Reply With Quote
  #4  
Old 08-05-2019, 04:03 AM
p45cal's Avatar
p45cal p45cal is offline Sum specific entries in column that are greater than zero Windows 10 Sum specific entries in column that are greater than zero Office 2016
Expert
 
Join Date: Apr 2014
Posts: 866
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Quote:
Originally Posted by Lugh View Post
Very nice, p45cal

My first thought—before seeing your answer—was a conditional formula in Col D which would:
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?
Yes, it will work, and it's straightforward and quite easy to maintain. It does require at least one helper column, which can be hidden.
I thought the OP was looking for a single-cell formula.
Reply With Quote
  #5  
Old 08-05-2019, 03:13 PM
skeletor66 skeletor66 is offline Sum specific entries in column that are greater than zero Windows 10 Sum specific entries in column that are greater than zero Office 2013
Novice
Sum specific entries in column that are greater than zero
 
Join Date: Jun 2019
Posts: 3
skeletor66 is on a distinguished road
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum specific entries in column that are greater than zero 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
Sum specific entries in column that are greater than zero 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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft