Total time spent with client

brianfosterblack

Active Member
Joined
Nov 1, 2011
Messages
251
so I want to know if I can do this as a formula or do I need to run a macro
I want to add up the time spent on each client in each month
On my "Clients" Sheet I have all my client listed in Column C from row 4 downwards
In row 3 from columns "I" to "T" I have the 12 months starting from Mar and ending with Feb (This abbreviated version of the months corresponds to the sheet name for each month)

Lets just take the "Mar" sheet
The client name which corresponds to the client name in my Client Sheet is in Column A from A6 Downwards
The days of the month are in column "E" to "AI" in row 5
Each row in the month only has 1 client in that row and 1 time under 1 of the days in the month
I need on my Client Sheet to add up all the time spent on that client in Mar month and then for each other month in the column for that month.

Can this be done as a formula or will I need to run a macro
I
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Quite a complicated formula using indirect
BUT assuming the sheet is named - MAR , APR , FEB etc
Also that the dates in the client Sheet are entered as TEXT and NOT dates
then this should work
=SUM(VLOOKUP($C4, INDIRECT("'"&D$3&"'!$A$6:$AI$30"),{5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35}, FALSE))

I have uploaded the Sheet onto dropbox , as well as using XL2BB here
NOT I have only added the MAR & APR Sheets - hence REF errors on other months

if the headers are real dates then it can still be done but a complicated formula
=SUMIFS(INDIRECT("'"&CHOOSE(MONTH(D$3),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")&"'!$E$6:$AI$30"),INDIRECT("'"&CHOOSE(MONTH(D$3),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")&"'!$A$6:$A$30"),$C4) INDIRECT("'"&CHOOSE(MONTH(D$3),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")&"'!$E$6:$AI$30"

SUM Clients (ETAF).xlsx
CDEFGH
3MARAPRMAYJUNJUL
4client14800#REF!#REF!#REF!
5client24008000#REF!#REF!#REF!
6client300#REF!#REF!#REF!
7client400#REF!#REF!#REF!
8client500#REF!#REF!#REF!
9client600#REF!#REF!#REF!
10client700#REF!#REF!#REF!
11client800#REF!#REF!#REF!
12client900#REF!#REF!#REF!
client
Cell Formulas
RangeFormula
D4:H12D4=SUM(VLOOKUP($C4, INDIRECT("'"&D$3&"'!$A$6:$AI$30"),{5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35}, FALSE))


SUM Clients (ETAF).xlsx
ABCDEFGHIJKLMNOPQRST
4
53/1/203/2/203/3/203/4/203/5/203/6/203/7/203/8/203/9/203/10/203/11/203/12/203/13/203/14/203/15/203/16/20
6client11111
7client2100100100
8client3
9client4
10client5
11client6
12client7
13client8
14client9
15
16
mar


 
Upvote 0
I got the formula to work on my client sheet by changing the letter "D" to and I as my months start in column "I" on this sheet. But it is only looking up and finding the fist instance of the client. On the monthly sheet a clients name could be repeated multiple times but the times could be in any of the columns as you have identified.
 
Upvote 0
then need to change to sumproduct if multiple rows
=SUMPRODUCT((INDIRECT("'"&D$3&"'!$E$6:$AI$1000"))*(INDIRECT("'"&D$3&"'!$A$6:$A$1000")=client!$C4))

need to relook at D to I , but a bit later after my dinner

update the share

SUM arange based on column of criteria.xlsx
CDEFGH
3MARAPRMAYJUNJUL
4client14048800#REF!#REF!#REF!
5client200#REF!#REF!#REF!
6client300#REF!#REF!#REF!
7client400#REF!#REF!#REF!
8client500#REF!#REF!#REF!
9client600#REF!#REF!#REF!
10client700#REF!#REF!#REF!
11client800#REF!#REF!#REF!
12client14048800#REF!#REF!#REF!
client
Cell Formulas
RangeFormula
D4:E12D4=SUMPRODUCT((INDIRECT("'"&D$3&"'!$E$6:$AI$1000"))*(INDIRECT("'"&D$3&"'!$A$6:$A$1000")=client!$C4))
F4:H12F4=SUM(VLOOKUP($C4, INDIRECT("'"&F$3&"'!$A$6:$AI$30"),{5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35}, FALSE))
 
Upvote 0
Ok, I see missed that in your first post - sorry
I have updated the share version
and heres the XL2BB

SUM arange based on column of criteria.xlsx
CDEFGHIJKLMN
3MARAPRMAYJUNJULAUG
4client14048800#REF!#REF!#REF!
5client200#REF!#REF!#REF!
6client300#REF!#REF!#REF!
7client400#REF!#REF!#REF!
8client500#REF!#REF!#REF!
9client600#REF!#REF!#REF!
10client700#REF!#REF!#REF!
11client800#REF!#REF!#REF!
12client14048800#REF!#REF!#REF!
client
Cell Formulas
RangeFormula
I4:J12I4=SUMPRODUCT((INDIRECT("'"&I$3&"'!$E$6:$AI$1000"))*(INDIRECT("'"&I$3&"'!$A$6:$A$1000")=client!$C4))
K4:M12K4=SUM(VLOOKUP($C4, INDIRECT("'"&K$3&"'!$A$6:$AI$30"),{5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35}, FALSE))
 
Upvote 0
i had a message from drop box, which i will keep the messages on the forum, rather than reply
I have updated the spreadsheet now, as mentioned on earlier reply - with sumproduct and a different name - see the link
I did mention if the Header is an actual date , then we can use a choose() to use that info
CHOOSE(MONTH(I$3),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
So easy to change and use the date from the header to lookup the sheet name
BUT I needed to see you data layout , and di mention if you could put on a share like dropbox OR use XL2BB add-in

modified to use MONTH from a real date on client sheet

SUMPRODUCT based on column of criteria.xlsx
CDEFGHIJK
33/1/204/1/20MAY
4client14048800#VALUE!
5client200#VALUE!
6client300#VALUE!
7client400#VALUE!
8client500#VALUE!
9client600#VALUE!
10client700#VALUE!
11client800#VALUE!
12client14048800#VALUE!
client
Cell Formulas
RangeFormula
I4:K12I4=SUMPRODUCT((INDIRECT("'"&CHOOSE(MONTH(I$3),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")&"'!$E$6:$AI$1000"))*(INDIRECT("'"&CHOOSE(MONTH(I$3),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")&"'!$A$6:$A$1000")=client!$C4))
 
Last edited:
Upvote 0
=SUMPRODUCT((INDIRECT("'"&I$3&"'!$E$6:$AI$1000"))*(INDIRECT("'"&I$3&"'!$A$6:$A$1000")=client!$C4))
I used this formula as I kept my headings on the Client sheet as Text. I was getting a &REF! error until I realised my sheet name is Clients not Client. Fixed this and it works like a charm. Thank you so much for your trouble and your patience with me as I still have to learn how to use many of these resources correctly
 
Upvote 0
Solution

Forum statistics

Threads
1,215,646
Messages
6,126,000
Members
449,279
Latest member
Faraz5023

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