Calculate contribution of Salesperson

AhmedAbdelhai

New Member
Joined
Jun 5, 2018
Messages
22
Dear,

Every month I receive a sales sheet similar to the one attached below. To do a year to date sales sheet I manually copy the new sales sheet and paste it under the old sales sheet. Then I do a pivot table and some interactive charts I learnt recently. The challenge I am facing is calculating the contribution of every salesperson as the accounts are distributed among them randomly.

I added a column to the sales sheet named "Salesperson " and I created a reference sheet and I was wondering if there is a way excel would check the reference sheet and add the sales person to the corresponding account in column D instead of me doing it manually. This will save me a lot of time and will help me avoid mistakes.

If anyone can help me with that or put me in the right direction to learn how to do it I'd really appreciate it.

Thank you

Download sample sheet here
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
if you are able to use PowerQuery ...

DateItemAccountSalespersonSales
01/01/2019​
aaaADavid
2000​
07/01/2019​
cccADavid
3000​
02/01/2019​
bbbDDavid
5000​
08/01/2019​
dddDDavid
1000​
09/01/2019​
aaaDDavid
2000​
03/01/2019​
cccFDavid
3000​
30/01/2019​
bbbFDavid
5000​
06/03/2019​
cccFDavid
3000​
04/01/2019​
dddHDavid
1000​
05/01/2019​
aaaNAshely
2000​
01/02/2019​
cccNAshely
3000​
06/01/2019​
bbbRRandy
5000​
02/02/2019​
dddRRandy
1000​
02/03/2019​
cccRRandy
3000​
03/02/2019​
aaaQRandy
2000​
04/03/2019​
aaaQRandy
2000​
04/02/2019​
bbbWCindy
5000​
03/03/2019​
dddWCindy
1000​
06/02/2019​
dddXCindy
1000​
aaaTRandy
2000​
01/03/2019​
bbbTRandy
5000​
31/03/2019​
dddSRandy
1000​
05/02/2019​
cccZCindy
3000​
05/03/2019​
bbbZCindy
5000​

Code:
[SIZE=1]let
    Source = Table.NestedJoin(Table2,{"Account"},Table1,{"account"},"Table1",JoinKind.LeftOuter),
    #"Expanded Table1" = Table.ExpandTableColumn(Source, "Table1", {"Salesperson"}, {"Salesperson"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded Table1",{"Date", "Item", "Account", "Salesperson", "Sales"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Reordered Columns",{{"Date", type date}})
in
    #"Changed Type"[/SIZE]

btw. on you sales sheet exist date which I've never seen: 2/38/2019 ;) . Here the cell with this date is blank
 
Last edited:
Upvote 0
lol my bad
Thank you very much
I have no idea what powerQuery is but thank for putting me in the right direction. I will try to learn how to do it using it.
 
Upvote 0
what is your Excel version ? if 2007 forget about PowerQuery

if 2010/2013 you'll need free add-in from MS site
if 2016 and above - it has PowerQuery built-in - Get&Transform

what is PowerQuery
 
Last edited:
Upvote 0
it's 2016 and I found it under the DATA tab
I'm now watching a tutorial to learn how you did this magnificent work :D
 
Upvote 0
in short...

in your sales sheet table salesperson column is not necessary, you can delete it
then
select your sales sheet table - From Table - Close&Load as Connection only
the same with reference table - From Table - not close&load but...

from PQ editor menu select Merge Queries as New
as first: select salesperson table - select account column
as second: select reference table - select account column
merge LeftOuter
ok
select expand table, uncheck account
ok
reorder columns as you need
close&load

edit: I need new keyboard I think :ROFLMAO:
 
Last edited:
Upvote 0
You are welcome :)
I made an animated procedure but as I see it completely unnecessarily because you managed it

have a nice day :)
 
Upvote 0

Forum statistics

Threads
1,215,388
Messages
6,124,658
Members
449,177
Latest member
Sousanna Aristiadou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top