Need cell to perform 'Loop until' calculation and then set final value to a cell

ck4242

New Member
Joined
Apr 8, 2019
Messages
8
Scenario looks like this:
3 cells involved:

A1 - Formula - Percentage value based on the SUM of three other % value cells (A1 does a simple SUM of three other cell % values)
B1 - Formula - Integer value based on simple arithmetic calculation of another cell's value (Looks at another cell's Integer value and does *2)
C1 - User input Integer - Percentage value - Statically defined by user

I need to compare A1's percentage against C1 percentage value (compare the statically defined % value against a resultant % value). The goal is for the value of B1 to be increased by 1 until A1 is less than or equal to C1. If the resultant A1 % value is GREATER than static C1 % value, then ADD 1 to B1 (I can do this much so far)....

But then I need a way to for the A1 vs C1 comparison to keep happening...and continue adding 1 to B1's value until A1 is no longer greater than C1.

What I have so far:
=IF(A1>B1,B1+1,B1) No idea how to put this into a loop UNTIL condition though.

I want this to work w/o any extra user input. Initially, the user will input certain values for things that are used to make calculations within the spreadsheet.
I know about the Solver, but this appears to be something that brings up a new window.


Is this achievable w/o using VBA or macros?
 
Thanks. Just got it working.
In yours, you don't declare any variables. Is this not needed here?

Code:
Sub FindOptimized_APs()

    Dim MaxSat As Integer
    Dim TotSat As Integer
    Dim OptimizedSat As Integer
    Dim InitialAPs As Integer
    Dim OptimizedAPs As Integer
        
    MaxSat = Range("B17").Value
    TotSat = Range("E32").Value
    OptimizedSat = Range("G32").Value
    InitialAPs = Range("B31").Value
    OptimizedAPs = Range("B33").Value
    OptimizedAPs = InitialAPs
    Range("B33").Value = OptimizedAPs
    
    ActiveSheet.EnableCalculation = True

    
    Do While Range("G32").Value >= MaxSat
        OptimizedAPs = OptimizedAPs + 1
        Range("B33").Value = OptimizedAPs
    Loop
End Sub
 
Last edited:
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,215,766
Messages
6,126,754
Members
449,336
Latest member
p17tootie

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