SOLVED

# Is it possible to create this type of function ?

Copper Contributor

# Is it possible to create this type of function ?

Hi I'm a french engineering student (my english may not be verry good/I hope you will understand : ) ), for my main project I need to create an algorithm and I don't know if it is possible on excel.

So I would like to be capable to know wich is the smallest value possible to complete a condition. My condition is a simple True or false. Today I can manually change the starting value and see if It's ok or not but I would like to make it automatically. So I imagine an algorithm or a function, wich can add 1,starting from 0, to a cell each time the test cell is False, and when this cell finally turn True stop this increment and let the smallest vallue in the cell.

I put a picture of the situation :

this my enter/result sheet, so I enter a value in A2 and with all caculations behind it return me a TRUE or FALSE in A13

My idea is to increase the value in A2 stating from 0 then test and if it's FALSE, add 1 to the last value and if it's TRUE let the value.

Is it possible to do it ? If yes can you put me in the way ? Is there another way to do it ?

If you need details I can give you more.

Victor BARTHELEMY

2 Replies
best response confirmed by HansVogelaar (MVP)
Solution

# Re: Is it possible to create this type of function ?

@victor_barth Have you tried Goal seek? Otherwise a very simple macro would do.

Sub SolveFor()
Dim ct As Long
Do
ct = ct + 1
Range("A2").Value = ct
Loop until Range("A12").Value
End Sub

# Re: Is it possible to create this type of function ?

It works perfectly as I imagine it
Thanks a lot!
1 best response

Accepted Solutions
best response confirmed by HansVogelaar (MVP)
Solution

# Re: Is it possible to create this type of function ?

@victor_barth Have you tried Goal seek? Otherwise a very simple macro would do.

Sub SolveFor()
Dim ct As Long
Do
ct = ct + 1
Range("A2").Value = ct
Loop until Range("A12").Value
End Sub