Can someone create a formula to work out this equation for me please?

Steven Layton 0 Reputation points
2025-04-26T08:53:25.5566667+00:00

Hi I'm struggling to work out the following, please can someone help with the formula? I apologise in advance but I've had to hide the nature of what I need the formula for.

I have a total number of "sweets" that need to be divided equally by 4. However there are occasions when I have "special sweets." These special sweets mean if you have a special sweet you can only have a total quantity of 3 sweets.

For example there are 20 sweets including 2 special sweets.

2 people get a special sweet each plus 2 additional sweets leaving 14 sweets.

3 people are going to get 4 sweets leaving 1 person to get 2 sweets.

The total number of bags I need is 6.

I need a formula to work out how many bags I need based on this information.

In Excel - FZ20 contains the total number of sweets (20)

FZ21 contains how many special sweets there are (2)

can someone create a formula that incorporates this cell information and the above criteria so FZ22 displays how many bags I need?

TIA

Steve

Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,880 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Barry Schwarz 3,736 Reputation points
    2025-04-26T10:42:06.9066667+00:00

    Let T = total number of sweets.

    Let S - number of special sweets.

    Let ]x[ denote the value of x rounded up to the nearest integer: ]4[=4, ]4.1[=5

    There are S bags of 3 sweets each. The number of remaining sweets is T-3S

    The number of bags needed is S + ](T-3S)/4[

    Substitute the cell references for T and S and invoke the appropriate Excel function and you have your formula.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.