little change to MOD function

Status
Not open for further replies.

Ady4um

New Member
Joined
Sep 25, 2011
Messages
6
Hello.

Straight to my situation.

Code:
A1: positive integer
A2: positive integer
A3: MOD(A1/A2,1)
A4: 1*(A3=0)
A5: A3+A4

The above MOD function in A3 returns values between:

Code:
0 < = (A1/A2) < 1

In A5 I manage to have:

Code:
0 < (A1/A2) < = 1

Which is what I want.

That result in A5 is almost the same as the MOD function in A3, except that when A3 results in 0 (zero), A5 results in 1 (one).

I don't really need A4 nor A3, so I could combine them as:

Code:
A6: MOD(A1/A2,1)+(MOD(A1/A2,1)=0)

There should be a simpler (or alternative) way to get the same result, but I couldn't find it. Ideas?

Thank you in advance.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Status
Not open for further replies.

Forum statistics

Threads
1,215,161
Messages
6,123,380
Members
449,097
Latest member
Jabe

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