If odd then even...

MKTetzlaff

New Member
Joined
Apr 8, 2006
Messages
20
Hi:

I think that I am going about this wrong.

I have the length of a needed part (balance rod) in cell L127=rounddown((L108-2),0). We have switched vendors and now are only using even length balance rods.

L108 contains the product height divided by 2.
L127 (balance length) can never be less than 10 or more than 48.
L127 always needs to produce a even number but cannot be more than one less than actual number.

example: L127 = 27.375 --> rounddown to 27 (odd needs to be 26 so substract 1)
example: L127 = 36.875 --> rounddown to 36 (ok because it is even so substract 0)
example: L127 = 37.000 --> rounddown to 37 (odd needs to be 36 so substract 1)

If the part length (L127) is an even number, I do not need to do anything. If cell L127 is an odd number, I need to round down one / substract one to get to the even number below it.

I was thinking of trying to make the rounddown(), fix(), int() work in some combination but it also changes even numbers. This seems way too complicated for what appears to be easy on the surface.

I think I need some way to test if L127 is odd, maybe a If=odd/Then substract 1, If=even/Then substract 0.

I appreciate any help you guys can provide either on a way to test if a number (L127) is odd or just making this work in general.

Thanks in advance,

- Mike T.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
Try this:

=IF(ISODD(INT(L108)),INT(L108)-1,INT(L108))
 

gsbelbin

Active Member
Joined
Aug 29, 2008
Messages
336
If your actual length is in L127, I think all you need to do is

FLOOR(L127,2)
 
Last edited:

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
The Analysis ToolPak Add-In has ISEVEN and ISODD functions. Otherwise:

=MOD(INT(L127),2)

will return zero if even, otherwise 1.
 

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
I think all you need to do is

FLOOR(L127,2)


This doesn't work, take the example 27.375, FLOOR(L27,2) gives 24 which is not what is expected.
 

Forum statistics

Threads
1,181,488
Messages
5,930,208
Members
436,722
Latest member
MrPager

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
Top