# If odd then even...

#### MKTetzlaff

##### New Member
Hi:

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.

- 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
Try this:

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

#### gsbelbin

##### Active Member
If your actual length is in L127, I think all you need to do is

FLOOR(L127,2)

Last edited:

#### Andrew Poulsom

##### MrExcel MVP
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
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.

#### gsbelbin

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

Not on my PC, it gives 26

#### cornflakegirl

##### Well-known Member
FLOOR works fine for me.

#### Lewiy

##### Well-known Member
Not on my PC, it gives 26

Bizarre, it's working now.....not sure what happened!! My apologies!

#### cornflakegirl

##### Well-known Member
We've told you before not to drink at lunchtime

#### MKTetzlaff

##### New Member
As always, thank you.

Replies
9
Views
556
Replies
7
Views
378
Replies
18
Views
2K
Replies
11
Views
1K
Replies
4
Views
2K

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.

### Which adblocker are you using?

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

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