Divide by VBA

ashani

Active Member
Joined
Mar 14, 2020
Messages
347
Office Version
  1. 365
Platform
  1. Windows
Hi

I wonder if someone could help me with this please.

- If in Column G select "social" then increase allowance by 20% of K1 for that particular day
- Also reduced equally for all other days - however the total should remain 700 in Column C.

I'd really appreciate your guidance in the attachment.

thanks

1587078618145.png
 
Hi

Thank you for the reply.

I'm trying but not getting what I'm trying to achieve.

Thanks once again.
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
When I’m trying to extend the formula to cover Training part and it’s not working as me come out with error message
 
Upvote 0
I'm not sure what's going on - spent last 2 days just to merge 2 IFs function to get the result but just not happening.

All I'm trying to do is the following :

Social example -

- Monday Social = Give 20% of 700 is 140 plus existing 100 so total = 240 - yeah ?
- Tuesday to Sunday = 77 as (240 - 700 = 490 / 6)
- If Social again selected say on Thursday than it will divide the first social into 2 and rest of the cells will remain the same i.e. (240 + 77 = 317 /2 = 159 approx)
- If every day is a social than it will be 100 each day

Training example : exactly the same as Social with 10%

- Monday Training = Give 10% of 700 is 70 plus existing 100 so total = 170 - yeah ?
- Tuesday to Sunday = 88 or 89 as (140 - 700 = 560 / 6)
- If Training again selected say on Thursday than it will divide the first social into 2 and rest of the cells will remain the same i.e. (170 + 89 = 259 /2 = 130 approx)
- If every day is a training than it will be 100 each day.

However, if No Social or Training selected and Work selected than it will remain for whatever the numbers are and don't change anything.

I'd really appreciate if you could provide me some guidance on the above example.

Many thanks once again for all your help.
 
Upvote 0
I'm not sure what's going on - spent last 2 days just to merge 2 IFs function to get the result but just not happening.
Do you think is that possible to do ?

Yes. It's easy to construct an IF() ... provided you are clear about the logic.

Based on your previous posts, it appears your "rules" are:

1. All days of the week are blank
Each day = 100

2. N days are SOCIAL, (7-N) days are blank
a) Total allocation for blank days = ROUND(N*(700-240)/6,0)
b) Total allocation for SOCIAL days = 700 - (a).
Each day rounded to an integer so that blank days total = (a) and SOCIAL days total = (b)

3. N days are TRAINING, (7-N) days are blank
Total allocation for blank days = ROUND(N*(700-170)/6,0)
Total allocation for TRAINING days = 700 - (a).
Each day rounded to an integer so that blank days total = (a) and TRAINING days total = (b)

Your screenshots then show a mix of SOCIAL, TRAINING, WORK and blank days, without explaining how you produce your results.

You'll need to codify as I have done above:
- the different calculations that may be made, and
- the conditions in which those calculations will apply.
 
Upvote 0

Forum statistics

Threads
1,217,367
Messages
6,136,136
Members
449,994
Latest member
Rocky Mountain High

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