Is there a formula to align odd and even numbers within cells?

rad7even

New Member
Joined
Dec 16, 2014
Messages
2
Hello all, I am using Excel 2013.

I have multiple columns w/ addresses (only the numbers, not the streets). I would like for odd ending numbers to be left-aligned and even ending numbers right-aligned.
Is there a formula or macro (if any) that I can utilize to select all the cells within a column and align these accordingly?:confused:

I searched here, kb's, and elsewhere but could not find anything helpful.

Thank you in advance.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Use this formula

=ISODD(A1)

then filter column by TRUE and align it to LEFT, vice versa.
 
Upvote 0
=ISODD(MID(A1,MAX(IF(ISERROR(MATCH(-{0,1,2,3,4,5,6,7,8,9},-MID(A1,ROW($1:$50),1),0))=TRUE,"a",MATCH(-{0,1,2,3,4,5,6,7,8,9},-MID(A1,ROW($1:$50),1),0))),1)*1)
Ctrl Shift Enter

This work even A1 contain text and last number can be in middle of the string
 
Upvote 0
Welcome to the MrExcel board!

Assuming the numbers are in column A, try this.

1. Select the column by clicking its heading label.

2. Home ribbon tab -> Conditional Formatting -> New rule -> Use a formula to determine which cells to format -> Format values where this formula is true: =ISODD(A1) -> Format... -> Number tab -> Category: select Text -> OK -> OK
 
Upvote 0
Thank you all for your prompt response. I have been manually aligning these cells for years until I was encouraged to try one of these forums. You have me learning a new function (=ISODD) and manipulating it to my advantage! I can now go to sleep comfortably and my work will now be performed in less steps, thanks to your replies. Thank you Peter_SSs for your welcome and also for your steps as they proved to be very helpful.
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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