IF Odd or Even ... return value

smithtm3

New Member
Joined
Dec 19, 2019
Messages
7
Office Version
  1. 365
Platform
  1. Windows
On one workbook spreadsheet I have values that are Odd and Even.
I want two columns one for Odd and one for Even.
Currently I am using an IF statement that returns True or False.
Is it possible to return the values?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Maybe something like
VBA Code:
=IF(ISODD(A1),A1,B1)
 
Upvote 0
If your data starts at A2:
In B2: =IF(MOD(A2,2)=0,"",A2)
Fill down.
In C2: =IF(MOD(A2,2)=0,A2,"")
Fill down.
 
Upvote 0
Or:
VBA Code:
Sub Maybe()
    With Range("A2:A" & Cells(Rows.Count, 1).End(xlUp).Row)
        With .Offset(, 1)
            .Formula = "=If(Mod(RC[-1], 2)=0,"""",RC[-1])"
            .Value = .Value
        End With
        With .Offset(, 2)
            .Formula = "=If(Mod(RC[-2], 2)=0,RC[-2],"""")"
            .Value = .Value
        End With
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,852
Members
449,096
Latest member
Erald

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