IF and ROUNDUP / ROUNDDOWN

HEORIST

New Member
Joined
Jul 15, 2019
Messages
4
Hi,

I am trying to compare 2 values: D39 and F39. The second IF gives me a FALSE result. Why is it so? I tried also stating it as D39>F39 and D39< F39 but still got the same result.

=IF(D39-F39>1;ROUNDDOWN(D39/F39;IF(D39-F39<1;ROUNDUP(D39/F39;0))))

Thank you for any help.
 
Last edited by a moderator:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
it helps if you tell us what's in D39 and F39
logic suggests that D39-F39=1
 
Upvote 0
If it's not less than & or greater than 1 then it must be 1.
What are D39 & F39?
 
Upvote 0
Hi,
Thanks for the quick reply.

I am trying to figure out how many vials I need given the dose needed. So D39 gives the amount of drug needed and F39 gives the amount of drug contained in a vial.
For ex, D39 can be 1100 mg and F39 can be 1200 mg vial. So in this case, 1 vial of F39 is needed with a 100 mg wastage. The other condition is when D39 is 1200 or more, for ex, if D39 is 1200 mg, then only 1 unit of F39 is needed. If D39 is 1800 mg, then 2 F39 vials are needed, with a wastage of 600 mg.
 
Upvote 0
Your rounddown formula is wrong, try
=IF(D39-F39>1,ROUNDDOWN(D39/F39,0),IF(D39-F39<1,ROUNDUP(D39/F39,0)))

But you will still get false if D39-F39=1
 
Upvote 0
Hi,

I am trying to compare 2 values: D39 and F39. The second IF gives me a FALSE result. Why is it so? I tried also stating it as D39>F39 and D39< F39 but still got the same result.

=IF(D39-F39>1;ROUNDDOWN(D39/F39;IF(D39-F39<1;ROUNDUP(D39/F39;0))))

Thank you for any help.


Will this work for you
=if(d39-F39)>=1,1,roundup(f39/d39,0))
 
Upvote 0
Your rounddown formula is wrong, try
=IF(D39-F39>1,ROUNDDOWN(D39/F39,0),IF(D39-F39<1,ROUNDUP(D39/F39,0)))

But you will still get false if D39-F39=1

Dear Fluff,

Thanks for this! It also worked.

Kind regards and have a good day.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,195
Members
453,021
Latest member
pingpong7117

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