+ Reply to Thread
Results 1 to 5 of 5

Divide a number into multiple cells based on logic

  1. #1
    Registered User
    Join Date
    01-05-2013
    Location
    Alaska
    MS-Off Ver
    Excel 2010
    Posts
    6

    Divide a number into multiple cells based on logic

    Hello,
    What I am trying to do is log hours daily and enter the daily total into a cell say (B7, B8...). Then I want to divide the cell, say B8 evenly into four categories. Each category has a maximum number of hours required and once that maximum number is reached I want to stop dividing into that cell. Like in the example below, we have 8 hours on Day 1 and since Cat A and Cat C are at their max 250 hours we don't divide into those. We show 4 hours in Cat B and 4 hours in Cat D.

    Right now I have a conditional format that just changes the text in the 'Hours' column to red once the limit of hours is hit and we are dividing by number of open categories and manually entering into the categories that are not full.
    What we would like to do is just enter the hours per day and have that number automatically divided and reported into the categories that have not reached their set maximum. If there is any way to do this with a formula it would be preferred over macro. Any advice or help would be greatly appreciated! Thanks, Jeff.

    Cat Hours Hours Day 1 - Hours Day 2 ....
    A 250
    B 100 4 4
    C 250
    D 25 4 4

    ENTER DAILY HOURS: 8 8

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Divide a number into multiple cells based on logic

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    01-05-2013
    Location
    Alaska
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Divide a number into multiple cells based on logic

    Hi Glenn, thank you. I was having trouble with the attachment on the original post.
    I have uploaded the attachment on this post, let's see if I was successful.

    Jeff
    Attached Files Attached Files

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Divide a number into multiple cells based on logic

    if there are 4 categories
    you have 8 hours to divide for each 2 hours
    if 2nd category required only 1 hour to reach a maximum level
    now we divide 1st Category 2 h, 2nd Category 1h, 3rd Category 2h and 4th Category 2h
    what about remaining 1 h
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Registered User
    Join Date
    01-05-2013
    Location
    Alaska
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Divide a number into multiple cells based on logic

    Hi Siva, the trick is to divide by the number of open categories. In your example, you have satisfied the 2nd category which leaves 3 categories unsatisfied.
    We would divide 8 / 3 = 2.66, so 2.66 would be calculated into each of the 3 open categories. Then once we have satisfied the next category, we would be dividing by 2 and so on...

    Thank you,
    Jeff

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Divide a number into multiple cells
    By rhon101 in forum Excel General
    Replies: 6
    Last Post: 03-03-2020, 08:20 PM
  2. VBA divide by number of cells used per row
    By hhae in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2016, 08:10 AM
  3. [SOLVED] How to divide a number into a multiple of 5 and the remainder
    By eocsur in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-08-2015, 05:12 AM
  4. [SOLVED] Divide a number into multiple cells
    By beitzy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-13-2013, 07:41 AM
  5. Text in a single cell based on logic of multiple other cells
    By dtrimble in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-12-2013, 01:33 AM
  6. Divide a number into multiple columns
    By monkeyman905 in forum Excel General
    Replies: 1
    Last Post: 10-25-2011, 02:57 PM
  7. Divide only with number of cells with value>0
    By primaxx in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-27-2009, 03:39 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1