IF condition

churmie

New Member
Joined
Jan 9, 2014
Messages
37
I need help with what should be easy formula but I can't get it right. I have the following figures:

22001000

<tbody>
</tbody>

The average is 2, but I have a separate Formula which is a minimum of 2.5. How do I replace the zero values with whichever is higher of the average or the minimum?

thanks!
 
Last edited by a moderator:

James006

Well-known Member
Joined
Apr 4, 2009
Messages
3,680
Hello,

Based on your example ... what is your expected result ?
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
4,706
Office Version
365
Platform
Windows
Perhaps...

=Max(average formula, minimum formula)
 

churmie

New Member
Joined
Jan 9, 2014
Messages
37
Hi James

The result I would expect is 2.5.

Yongle - The max formula doesn't work how I want it to. I only want to change cells with a zero value. I tried what you had but it changed values to a higher number when it wasn't a zero.
 

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
3,970
Office Version
365, 2019, 2016
Platform
Windows
how about?

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style="text-align: right;;">2</td><td style="text-align: right;;">2</td><td style="text-align: right;;">0</td><td style="text-align: right;;">0</td><td style="text-align: right;;">10</td><td style="text-align: right;;">0</td><td style="text-align: right;;">0</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style="text-align: right;background-color: #E2EFDA;;">2</td><td style="text-align: right;background-color: #E2EFDA;;">2</td><td style="text-align: right;background-color: #E2EFDA;;">2.5</td><td style="text-align: right;background-color: #E2EFDA;;">2.5</td><td style="text-align: right;background-color: #E2EFDA;;">2</td><td style="text-align: right;background-color: #E2EFDA;;">2.5</td><td style="text-align: right;background-color: #E2EFDA;;">2.5</td></tr></tbody></table><p style="width:4.8em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">A2</th><td style="text-align:left">=IF(<font color="Blue">A1=0,MAX(<font color="Red">AVERAGE(<font color="Green">$A$1:$G$1</font>),2.5</font>),AVERAGE(<font color="Red">$A$1:$G$1</font>)</font>)</td></tr></tbody></table></td></tr></table><br />
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
4,706
Office Version
365
Platform
Windows
I do not understand what is being tested, but in principle
=IF(something = 0,MAX(AVG formula, MIN formula), something)
Something may be the same cell ref or the same formula)
 

churmie

New Member
Joined
Jan 9, 2014
Messages
37
Thanks Alan, but cell E1 changes the 10 to a 2 which I do not want. I only want to change the zero's. The figure 2.5 is a separate formula but ca also change dependent on the worksheet I am looking at

A B C D E F G MIN AVE
1 2 2 0 0 10 0 0 2 4.7
****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;"> 0002ABCDEFG1220010002222.52.522.52.5</body>2 2 2 4.7 4.7 10 4.7 4.7

i need it to look like this.... Sorry for not being clear
 
Last edited:

James006

Well-known Member
Joined
Apr 4, 2009
Messages
3,680
Quite honestly ...

It is not clear at all ...

Replacing zero values by any number ... will change your average ... and create a circular reference ...
 

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
3,970
Office Version
365, 2019, 2016
Platform
Windows
ok, try this instead

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style="text-align: right;;">2</td><td style="text-align: right;;">2</td><td style="text-align: right;;">0</td><td style="text-align: right;;">0</td><td style="text-align: right;;">10</td><td style="text-align: right;;">0</td><td style="text-align: right;;">0</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style="text-align: right;background-color: #E2EFDA;;">2</td><td style="text-align: right;background-color: #E2EFDA;;">2</td><td style="text-align: right;background-color: #E2EFDA;;">2.5</td><td style="text-align: right;background-color: #E2EFDA;;">2.5</td><td style="text-align: right;background-color: #E2EFDA;;">10</td><td style="text-align: right;background-color: #E2EFDA;;">2.5</td><td style="text-align: right;background-color: #E2EFDA;;">2.5</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style="text-align: right;background-color: #E2EFDA;;">2.5</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr></tbody></table><p style="width:4.8em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">A2</th><td style="text-align:left">=IF(<font color="Blue">A1=0,MAX(<font color="Red">AVERAGE(<font color="Green">$A$1:$G$1</font>),$A$4</font>),A1</font>)</td></tr><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">A4</th><td style="text-align:left">=10/4</td></tr></tbody></table></td></tr></table><br />
 
Last edited:

churmie

New Member
Joined
Jan 9, 2014
Messages
37
ABCDEFGHIJKLMNOPQRSTUV
1MonTueWedThuFriSatSunMin StockAverageMonTueWedThuFriSatSun
2220010002.54.7224.74.7104.74.7

<tbody>
</tbody>


Sorry, let's put it in a better table. Columns P-V is what I want the results to look like. Column P did not change value because it has a value already. The zero needs to be replaced with the greater of the Min Stock or Average (Column M & N).
 

Forum statistics

Threads
1,082,359
Messages
5,364,916
Members
400,815
Latest member
Joaquin Phoenix

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top