multiple condition & multiple solution in excel - excel

Please help if possible.
I want to create a dashboard in excel, where I want to calculate the total sales of the agents in my shift. But the problem is that I want to calculate multiple agent's sale score in a single case as well.
Conditions:
If in a single sale, there are 3 agents, the sale would be divided among the three with the 3rd person getting 50% of the sale amount and the 1st and the 2nd person both getting 25%.
If in a single sale, there are 2 agents, the sale would be divided among them equally.
If a single agent cracks the sale, the amount would belong to him alone.
Now how would I put a formula where these things are calculated automatically?
e.g.:
Agent 1 Agent 2 Agent 3 Sale Amount
Adam $100
Jack Adam $100
Nick Vince Adam $100
Vince $100
According to this, the amount would be as such:
Adam: - $100 + $50 + $50 = $200
Jack: - $50 = $50
Nick: - $25 = $25
Vince: - $25 + $100 = $125
This is the kind of result I want but want to get it done automatically as soon as the sale is entered. Anyone know how to achieve it through formula?
Thanks in Advance!

Hope this help you out. I tested it and it appears to work.

You can try following formula:
=SUMPRODUCT(CHOOSE(MMULT(--($A$2:$C$5<>""),{1;1;1}),{1,0,0},{0.5,0.5,0},{0.25,0.25,0.5})*($A$2:$C$5=G1)*$D$2:$D$5)
if necessary change the ranges automatically in the formula, convert main range to table:

Related

Choose correct PRODUCT COST from ROW based on amount sold

I am making a sheet to CALCULATE REAL REVENUE from each sale I make on my online store.
The problem is that the COST of my products is not always constant. It varies depending on many factors so each time I make a purchase I add the NEW PRODUCTS COST (LATEST COST).
Each time I make a new purchase I will add the QUANTITY and the new COST. (PURCHASE 1, PURCHASE 2, PURCHASE 3,etc).
Screenshoot of my sheet with example on ROW 41
In Column B I want to know which is the CURRENT COST based on the amount of TOTAL SALES of each product.
For example:
If I have sold less than 100 ( Pruchase 1 QUANTITY) then I need the formula to choose value of E41 (PURCHASE 1 COST).
If I have sold MORE than 100 and LESS than 300 (which is the SUM of PURCHASE 1 & PURCHASE 2) I need the formula to choose value of G41 (PURCHASE 2 COST) AND SO ON...
The formula I have come up with so far is this:
=INDEX(41:41,,IF(C41<=D41,COLUMN(E41),IF(C41<=D41+F41,COLUMN(E41)+2,IF(C41<=D41+F41+H41,COLUMN(E41)+4,COLUMN(E41)+6))))
This formula WORKS but only for the first 3 PURCHASES.
I need a formula that has no limit but I don't know how to make a VARIABLE formula.
Please take my words literally when I say that I wouldn't waste one minute on trying to solve your problem with your current sheet design. You would need VBA, and then extract quantities and prices from each purchase without the ability to filter on columns. (Minute is up.)
What you need is a Purchase database: ItemID, Date, Quantity, Price, maybe Ref#. From that you can pull out the transactions for any item by filtering on the item and the cost by using functions like SUMIF. However, this just brings the real problem within reach without solving it.
The problem is that when you buy 100 pcs #42 your price is 42. Then you buy another 100 pieces #46 your average price is 44. But if you sold 50 pieces with a cost of 42 then the average cost of the remaining 150 is 45. Therefore you can't determine the average cost of any remainder without knowing the quantity sold and the average cost applied to that sale. To solve that problem you will still need VBA but the suggested db format of purchase record would at least support such a solution.
Not so long ago I programmed a solution where there were additional columns in the db and each sale was recorded in 3 columns (much like your present purchase record): date, Qty, Ref. In this way I could trace the sale of each individual purchase (this was for shares trading). The sale of the newer quantity wouldn't start until the earlier quantity was sold out.
Perhaps you don't need to trace where the purchased quantity went to and just need one column to count down the balance to zero. That would be much simpler but has the drawback that you can't roll back errors. In the end the rollback was the reason why I abandoned the design. The key to the ability to abandon it is a similar db for sales: date, qty, price, Ref#.
With such a setup you might design a system to either extract the average or FiFo price from the purchase side and associate it with a sale. If the condition is that it should be done with worksheet functions you could add a column for "current cost" in the purchase db, changing with each purchase, which you look up by date from the sales side using VLOOKUP or SUMPRODUCT, having set a cost price applicable from the day of purchase until the next. If that appeals to you, a method must be found to deal with days on which there are both purchases and sales.

How can I determine how much time a customer has spent speaking to multiple agents

I have a spreadsheet in which each records the amount of time a customer spent on the phone with an agent, I want to write a formula that averages the total time spent by a user per agent.
Customer Agent Time spent (MM:SS)
John Smith Sally Jenkins 1:15
John Smith Sally Jenkins 2:07
John Smith Adam Apple 3:55
John Smith Adam Apple 1:42
For example, how can I determine the average time John Smith Sent with Sally Jenkins, output that, and then separately determine the average time John Smith spent with Adam apple?
Is that even possible? Any help would appreciated. Thank you!
The simplest way is probably to use a Pivot Table. Insert a Pivot Table based on your data, then put Agent in the Rows, and Average of Time Spent in the values.
You can also use SumIfs()/CountIfs to get an average over a large dataset given specific criteria without needing to manually select the cells with the times to average. With this, you can select the entire data range and the formula will figure out which cells to include in the average based on the criteria you specify.
=SUMIFS($C$2:$C$5,$A$2:$A$5,F2,$B$2:$B$5,G2)/COUNTIFS($A$2:$A$5,F2,$B$2:$B$5,G2)
I don't know of anything simpler than AVERAGEIF/AVERAGEIFS.
In G2 per image (and filled down),
=AVERAGEIFS(C:C, A:A, E2, B:B, F2)
In G6 per image,
=AVERAGEIFS(C:C, A:A, E6)
If your cells are formatted properly, you can just use =AVERAGE():

Trying to figure out a spreadsheet equation to balance bills

Basically I have a spreadsheet to show what has been paid by each member of a household on monthly bills, and I want it to show how much is owed to each other tenant, so that each has paid an equal share.
e.g. if tenant 1 pays $100, 2 pays $200 and 3 pays $300, tenant 1 would owe tenant 3 $100.
Any help will be greatly appreciated
Edit: I've since made this question a lot clearer. I'm sorry if it was a little sloppy before :(
Edit: I have tried (((C:2 + C:3 + C:4) / 3) - C:4) which shows how much more tenant 3 has to pay, but now I need to split that between tenants 1 and 2 so that they have each paid $132.67
I changed your layout slightly so I can copy the formula down.
I am using Excel but it Should work in Google Sheets:
=IF(SIGN(VLOOKUP(A7,A:C,3,FALSE)-AVERAGE($C$2:$C$4))=-1,MIN(MAX(VLOOKUP(B7,A:C,3,FALSE)-AVERAGE($C$2:$C$4),0),AVERAGE($C$2:$C$4)-VLOOKUP(A7,A:C,3,FALSE)),0)

Count Unique Entries in a Month for Pivot Table

Good afternoon,
I'm currently working on setting up a pivot table for chart that outlines an Average Revenue per Person by Line Type. Using the pivot table, I can sort everything out, but when I try to get a count of person, it adds all instances of that person's name up. What I want is that if the person's name appears once in a month, all other instances in that month of the person's name are not counted. But during a new month, the person's name will appear once more. So, it is somewhat like a unique count, but only unique per month.
My excel table looks something like:
A B C D
Date Person Revenue Line Type
1/1/2015 John $100 Toy
1/6/2015 Phil $200 Toy
1/6/2015 Jane $25 Garden
1/7/2015 John $50 Electronics
1/25/2015 John $10 Electronics
2/1/2015 John $10 Toy
2/17/2015 Phil $30 Garden
2/20/2015 Bob $500 Electronics
2/21/2015 Jane $100 Garden
So, as you can see, a person's name can occur more than one time in a month, and in more than one month. Currently, the code I am using for my helper column (E) is:
=1/COUNTIF($B:$B,B2)
This has only been giving me a count of patients throughout the entire year, not taking new months into account. I also have attempted this formula:
=IF(SUMPRODUCT(($B$2:$B2=B2)*($A$2:$A2=A2))>1,0,1
This only counts values that occur on the same day. I've tried adding in MONTH() checks and such, and am only getting syntax errors. I'm not sure where to turn for this one. Thank you!
Thanks to #TomSharpe's advice, I added a helper column to concatenate Month/Date and the Patient's name like so:
=MONTH(A2)&"-"&B2
Then used the original formula (below) to COUNTIF divided by 1.
=1/COUNTIF($B:$B,B2)
This gave me exactly what I needed.
Thanks again!

How do I represent sums at different levels in Cognos 8?

I'm writing a report in Cognos. I want to represent all outstanding values for clients. This includes time we've worked but not billed (Unbilled) and unpaid invoices we've billed. Unbilled is a summed value with only one line. Invoices may have multiple lines as I want to keep the invoice number detail.
Unbilled Outstanding
-------- -------------
client Fees | Costs invoice | invoice Date | invoice amt
ABC $100 $25 B989 10/10/2013 $200
DD89 05/19/2013 $400
87R 07/14/2013 $300
XYZ $11 0
LMN 0 0 TRT11 01/01/2013 $500
Is this the best way to represent this, and if so, how do I do it? If not, how?
Thanks.
I found a document that explained it. The document is called Multiple Aligned Column Headers In Lists and Crosstabs. I found it on the IBM Developer Works website.
HTH

Resources