Expanding a formula / adding an IF condition

Timber5

New Member
Joined
May 29, 2024
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Currently I have this formula in one of the columns (AM) of the table:
=IFERROR(IFS(AL="No",P/AK*AJ,AL="Yes",AJ*10*0.9),"")

Now I need to add another function to it, namely: if AM<AN, then take the value from AN and put it into AM.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try:
Excel Formula:
=MAX(IFERROR(IFS(AL="No",P/AK*AJ,AL="Yes",AJ*10*0.9),""),AN)
 
Upvote 0
works like a charm, but in case there are #VALUE errors (relevant, when there is no data in P or AJ columns), how do I get rid of them now?
 
Upvote 0
What do you want to return?
Currently the IFERROR is handling that. It should be returning empty string and MAX will ignore that empty string and return AN.
 
Upvote 0
So first I want AN to display empty cells, if there is no data in P.
AJ, AK and AM are populated automatically (VLOOKUP) based on another sheet, but there are instances (5%) where the data is not available and those rows are empty.
Whenever there is a value in AM and it is higher than what's calculated in AN, I need AN to replace the calculation and put the value from AM.

Current formula in AN is: =MAX(IFERROR(IFS(AL3="No",P3/AK3*AJ3,AL3="Yes",AJ3*10*0.9),""),AM3)
However whenever there is an empty cell in P and/or AJ, AM is no longer empty and the #VALUE error appears.
 
Upvote 0
However whenever there is an empty cell in P and/or AJ, AM is no longer empty and the #VALUE error appears.
That doesn't sound right. All errors are being handled by IFERROR. Can you show an example?

Edit: Your formula is wrong the last part should be AN3.
Rich (BB code):
=MAX(IFERROR(IFS(AL3="No",P3/AK3*AJ3,AL3="Yes",AJ3*10*0.9),""),AN3)
 
Upvote 0
OK, so this one works fine:
=IF(AM3>IFERROR(IFS(AL3="No",P3/AK3*AJ3,AL3="Yes",AJ3*10*0.9),""),AM,IFERROR(IFS(AL3="No",P3/AK3*AJ3,AL3="Yes",AJ3*10*0.9),""))
 
Upvote 0

Forum statistics

Threads
1,224,836
Messages
6,181,251
Members
453,027
Latest member
Lost_in_spreadsheets

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