Simple Question for an Expert

BrettOlbrys1

Board Regular
Joined
May 1, 2018
Messages
139
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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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