Simple Question for an Expert

BrettOlbrys1

Board Regular
Joined
May 1, 2018
Messages
128
Office Version
  1. 365
Platform
  1. Windows
I know this is probably simple, but I am having trouble. I simply want to return the first value in a row that is not blank. So if X=blank:

X X 4 X 5 6 1 X 5
X 3 X 5 X X X X X

For the 1st row, the returned value would be 4
For the 2nd row, the returned value would be 3

What is the formula I need to use to return the 1st non-blank value in a row?

Thanks
 
That's interesting. I'll have to look at what it's doing. Thanks
As noted, the OP seems happy with the worksheet formula suggestion, but if we are investigating UDFs, then another one might be
Code:
Function FirstOne(rng As Range)
  FirstOne = rng.Find("?*", rng.Cells(rng.Cells.Count), xlValues, , xlPrevious).Value
End Function
Comments:
- This, like crazydragon's but unlike Rick's, would work on a single column range as well as a single row range. ('First' in a multi-row or multi-column range is meaningless without further definition of what 'First' means).
- This, like the worksheet functions, returns an error if there are no values in the range. To me, that is a more informative result than 0 (crazydragon) or null string (Rick)
- This, like crazydragon's but unlike Rick's, preserves a numerical value as such (rather than converting it to a string) & also preserves multi-word values.
 
Upvote 0

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

Forum statistics

Threads
1,214,629
Messages
6,120,630
Members
448,973
Latest member
ChristineC

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