How to create an Excel formula that allows the left-adjacent cell to overflow if the value is blank or error

Mrock1

New Member
Joined
Oct 7, 2014
Messages
25
Excel will not allow you to create a formula that returns truly blank cell, causing the left-adjacent cell to truncate on display.
I figured out a workaround:
Format your adjacent cells (e.g. A1 and B1) with a fixed space font (e.g. Courier New) and have the null or error value returned by the formula in the right hand cell return this value:
MID(A1,INDEX(CELL("width",A1)-1,1),999)
You will have to make the left cell (A1) width a whole number of characters and may have to fiddle with the font size and integer value subtracted from the CELL function, but it does work reasonably well.
It simply displays the cells to the right of the string in A1 based on the column width in characters. The INDEX function is necessary because CELL width returns and array with two values; the cell width in characters and a true or false depending whether the column is the default width or not (we don't care about that true or false).parti
You can extrapolate this technique to additional right-hand cells that may contain formulae that you want to overflow the left-most cell (A1) if they return a null or blank. As before use a fixed space font and you may need to tweak the value subtracted from the INDEX(CELL) function.

This is particularly useful when using tables in which you want to used a formula in a column without having to individually delete it from individual cells on rows that may, say, be sub-headings.

Hope someone finds this useful.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

TotallyConfused

Board Regular
Joined
May 4, 2017
Messages
247
Office Version
  1. 365
Platform
  1. Windows
Hello Mrock1

While I don't need this at the moment, I have bookmarked it for possible future use. When I get a chance, I'll set up a situation as described and try your solution as I can see where it may come in handy. Thanks for posting this as I'm sure other people may find a use for it.

TotallyConfused
 

Watch MrExcel Video

Forum statistics

Threads
1,130,157
Messages
5,640,462
Members
417,144
Latest member
Pitsi Mokoele

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