Is there a Justify IF function?

Daneshav

New Member
Joined
Jan 12, 2011
Messages
2
I have a range E15:O87 that uses an IF and lookup function in each cell. It returns either a number or N/A. If it returns N/A, I would like it to be centered. If it returns a number I would like it to be left justified. I'm not really sure how to use code but if that's what it takes, I can follow dirrections to get it implemented. How should I go about doing this?

Can anyone help?

-Dani<!-- / message -->
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to the board!

You can do this with conditional formatting. Use the conditional formatting formula:

=iserror(E15)

...and the format to be centered. Then manually put all the cells to the left side. Those that return errors will be centered. Hope that helps. You can get to conditional formatting by selecting the cells and alt+O,D
 
Upvote 0
What is the purpose for centering N/A values. By default, Excel will left align text and right align values. Maybe if I understood the purpose for centering the value, I could give you a workaround? What if you pull N/A values into another column with a formula and then Center that column??

Another option would be to write a macro that will check for the value of each cell and then format it appropriately. A little more involved than a formula though.

cboshdave
 
Upvote 0
You can do this with conditional formatting.
Conditional formatting doesn't support cell alignment as a formatting option.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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