New IFBLANK Function

nouseforaname1982

Board Regular
Joined
May 25, 2004
Messages
73
I have made the following function to return a referenced cell's value if there is one, but will leave the cell blank if there is nothing in the cell.

Can you think of any ways to improve this code? Add functionality to it? Maybe with some optional variables?

Post if you have suggestions.


Function IFBLANK(MyRange As Range) As Variant

If MyRange = "" Then IFBLANK = "" Else IFBLANK = MyRange

End Function
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
This is very easy to do with native Excel functions, why the UDF?

=IF(A1="","",A1)
 
Upvote 0
This is very easy to do with native Excel functions, why the UDF?

=IF(A1="","",A1)

I am using it often and referencing the different sheets. So the "A2" in your formula is more complicated. its just a time saver right now but I may add some functionality to it.

My goal was to make it similar to the IFERROR function.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

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