Automatic calculation of minimum or maximum value in a cell

Hi guys

I want a macro that can calculate automatically the minimum or the maximum value of a cell depending on other cell's data. I am explaining:

I have cells A1, A2, A3 and A4 containing data. In cell C1 I have a formula that depends on data of the cells I mentioned. The relevancy of that data and cell C1 is not direct (the data of A1 to A4 goes to other cells fist before C1)
I am asking for a macro that gives me the minimum (or maximum) value that cell C1 can get while I define the range of values that A1 to A4 can get (i.e. the minimum and the maximum value of each cell, lets say min=5 and max=15)

Note: I will use that macro in several quartets of cells from which C1 takes data

Thanks in advance
i hope it's not so difficult for you to find a solution

AttachmentSize
Example.xlsx9.26 KB