Simplifying a formula that calculates time.

bionicle

Board Regular
Joined
Apr 23, 2009
Messages
186
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Need some help please.

I'm working in a spread sheet that calculates an overall time based on weekly, monthly, quarterly, Bi-annual and yearly time allocation as below (Columns P-T Row9).

P
Q
R
S
T

<tbody>
</tbody>

Weekly
Monthly
Quarterly
Bi-annual
Yearly
0.25
0.33
0.50
0.50
2.00

<tbody>
</tbody>

The above accumulated time equals 16.17 hours total for the year however the formula I use is very long and slows everything down, I also multiplies the above by a value in D9 (1 gives the above 2 would double it and so on).

I need help in making the formula smaller and easier to manage, I have used a sum product in the past which calculates well however doesn't give he same results.

the formula being used is:

=IFERROR((IF(AND(P9>0,Q9=0,R9=0,S9=0,T9=0),P9*52,IF(AND(P9>0,Q9>0,R9=0,S9=0,T9=0),SUM(P9*40+Q9*12),IF(AND(P9>0,Q9>0,R9>0,S9=0,T9=0),SUM(P9*40+Q9*8+R9*4),IF(AND(P9>0,Q9>0,R9>0,S9>0,T9=0),SUM(P9*40+Q9*8+R9*2+S9*2),IF(AND(P9>0,Q9>0,R9>0,S9>0,T9>0),SUM(P9*40+Q9*8+R9*2+S9+T9),IF(AND(P9>0,Q9>0,R9=0,S9>0,T9=0),SUM(P9*40+Q9*10+S9*2),IF(AND(P9=0,Q9=0,R9=0,S9=0,T9>0),T9,IF(AND(P9=0,Q9>0,R9>0,S9>0,T9>0),SUM(Q9*8+R9*2+S9+T9),IF(AND(P9>0,Q9=0,R9>0,S9>0,T9>0),SUM(P9*48+R9*2+S9+T9),IF(AND(P9=0,Q9>0,R9=0,S9=0,T9=0),SUM(Q9*12),IF(AND(P9=0,Q9=0,R9>0,S9=0,T9=0),SUM(R9*4),IF(AND(P9>0,Q9=0,R9>0,S9=0,T9=0),SUM(P9*48+R9*4),IF(AND(P9=0,Q9=0,R9=0,S9>0,T9=0),SUM(S9*2),IF(AND(P9=0,Q9>0,R9>0,S9=0,T9=0),SUM(Q9*8+R9*4),IF(AND(P9>0,Q9>0,R9=0,S9>0,T9>0),SUM(P9*40+Q9*10+S9+T9),IF(AND(P9>0,Q9>0,R9>0,S9=0,T9>0),SUM(P9*40+Q9*8+R9*3+T9),IF(AND(P9=0,Q9=0,R9>0,S9>0,T9>0),SUM(R9*2+S9+T9),IF(AND(P9=0,Q9>0,R9=0,S9>0,T9>0),SUM(P9*40+Q9*10+S9+T9),IF(AND(P9>0,Q9=0,R9=0,S9>0,T9>0),SUM(P9*50+S9+T9),IF(AND(P9>0,Q9=0,R9>0,S9=0,T9>0),SUM(P9*48+R9*3+T9),IF(AND(P9=0,Q9>0,R9>0,S9>0,T9=0),SUM(Q9*8+R9*2+S9*2),IF(AND(P9>0,Q9>0,R9=0,S9=0,T9>0),SUM(P9*40+Q9*11+T9),IF(AND(P9=0,Q9=0,R9=0,S9>0,T9>0),SUM(S9+T9),IF(AND(P9=0,Q9=0,R9>0,S9=0,T9>0),SUM(R9*3+T9),IF(AND(P9=0,Q9>0,R9=0,S9=0,T9>0),SUM(Q9*11+T9),IF(AND(P9=0,Q9=0,R9>0,S9>0,T9=0),SUM(R9*2+S9*2),IF(AND(P9>0,Q9=0,R9=0,S9=0,T9>0),SUM(P9*51+T9),IF(AND(P9=0,Q9>0,R9=0,S9>0,T9=0),SUM(Q9*10+S9*2),IF(AND(P9>0,Q9=0,R9=0,S9>0,T9=0),SUM(P9*50+S9*2),IF(AND(P9=0,Q9>0,R9>0,S9=0,T9>0),SUM(Q9*8+R9*3+T9),""))))))))))))))))))))))))))))))*D9),0)

As you can see its a beast, is there a way o make this smaller with the same results?

There area few virtual beers given and a huge thank you for an help.

thanks

Steve
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
=P9*40+Q9*12 gives the same results as =SUM(P9*40+Q9*12)

Can you post an example of your data and describe what you want to calculate.
Please also state your expected results.

There are tools available to post examples on to the forum.

See expected Add-in at the top of the messages.
 
Upvote 0
That's a question I cant answer as the person that created the formula no longer works within our business thus the need to review it.
 
Upvote 0
Probably easier ways, but as a start how about
=T9+S9*IF(T9>0,1,2)+R9*IF(S9>0,2,IF(T9>0,3,4))+Q9*IF(R9>0,8,IF(S9>0,10,IF(T9>0,11,12)))+P9*IF(Q9>0,40,IF(R9>0,48,IF(S9>0,50,IF(T9>0,51,52))))*D9

Although I don't understand the reasoning.
P9*52 drops to P9*40 if there is a monthly value, which i understand
but why do you get P9*51 if you have a yearly value, I would have thought it should be P9*0
 
Last edited:
Upvote 0
hi Fluff

formula works a treat, how would put the iferror statement onto this?

Steve
 
Upvote 0
Hi Fluff,

Me again, jus noticed that the multiplier isn't multiplying the value, an ideas?
 
Upvote 0
Problem solved...create of virtual beer heading your way..
 
Upvote 0
Just reading that formula and im intreged as to what its used for. Why do you keep using approx 3/4 of one measure and adding it to a years worth of another? eg:

SUM(P9*40+Q9*12)
 
Upvote 0
the formula calculates time, it should add hours together based on their value and monthly allocation.
 
Upvote 0

Forum statistics

Threads
1,215,217
Messages
6,123,675
Members
449,116
Latest member
HypnoFant

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