Return Value Under Certain Conditions

jdpro

Board Regular
Joined
May 1, 2016
Messages
88
Office Version
  1. 365
Platform
  1. MacOS
Good day all! 🖐️ :)

I would like to calculate values in column H, but if (E>F), then I need the calculation to be 0 or blank.

My current formula in column I is:
=IF(ISBLANK(G8),(D8*(A8*100))-(F8-E8)*A8*100)
It returns what I'm looking for, except when E>F
I manually entered the values in H to compare what I'm looking for vs what the formula gives me in I.

Your help is very much appreciated. :)

Screen Shot 2024-10-06 at 3.13.36 PM.png
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Also I would really like to hide the FALSE but not sure how to do that. Thank you :)
 
Upvote 0
Hi jdpro. Maybe....
VBA Code:
=IF(E8<F8,IF(ISBLANK(G8),(D8*(A8*100))-(F8-E8)*A8*100),0)
HTH. Dave
 
Upvote 1
Hi NdNoviceHlp, and thank you!

I think we're halfway there. Here's the result. H is my desired outcome, I is my old formula, J is your formula. The bottom line is correct which is the most important thing.
It returns FALSE when the date is filled and E<F, and 0 when date is filled and E>F. Could I get a 0 instead of FALSE to make it more presentable?

Screen Shot 2024-10-06 at 4.21.27 PM.png
 
Upvote 0
For the future I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with. ;)
If you have trouble with XL2BB, review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of the XL2BB Instructions page linked above.

Try
Excel Formula:
=IF(AND(G2="",E2<=F2),(D2-F2+E2)*A2*100,0)
 
Upvote 1
Solution
For the future I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with. ;)
If you have trouble with XL2BB, review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of the XL2BB Instructions page linked above.

Try
Excel Formula:
=IF(AND(G2="",E2<=F2),(D2-F2+E2)*A2*100,0)
Thank you much. Peter, this helped and is more condensed which is always nice.

I have tried to work with XL2bb but was not successful, will try it again. It would be much easier. I thought it might be because I am on a MAC that caused the issues I was having. But will look into it again. Always appreciate your help.
 
Upvote 0
Thank you much. Peter, this helped and is more condensed which is always nice.
Cheers. It can actually be condensed a bit more
Excel Formula:
=AND(G2="",E2<=F2)*(D2-F2+E2)*A2*100
or
Excel Formula:
=(D2-F2+E2)*A2*100*(G2="")*(E2<=F2)

I have tried to work with XL2bb but was not successful, will try it again. It would be much easier. I thought it might be because I am on a MAC that caused the issues I was having.
MAC should be fine, provided you are using 365 per your profile.
Check the suggestions in this thread (though I am not sure if they are all relevant to MAC systems) otherwise tell us just what problems you run into and at what point of the instructions that occurs.
 
Last edited:
Upvote 1

Forum statistics

Threads
1,223,867
Messages
6,175,069
Members
452,611
Latest member
bls2024

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