Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I find the first value in a range of cells 3

Status
Not open for further replies.

puforee

Technical User
Oct 6, 2006
741
US
On a 2003 Excell spreadsheet I have a row that consists of many columns. 11 of these columns (11 fields for each row) might contain data. I created a new column, just to the left of the 11 columns, and in its cell (field) I want to return the value of the first cell that has data...out of the 11 cells to the right.

I tried to do a little chart to show this but...when previewed it looked bad.
Can anyone help...Function or VB.

Thanks,
 
hi,

Take a look at the INDEX() function.

For instance for row 2 it might be...
[tt]
=INDEX(A2:K2,1,1)
[/tt]


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
SkipVought...great suggestion...and in doing more research I came up with this.
=INDEX(A1:A10,MATCH(TRUE,A1:A10<>0,0)) 'First entry'
=INDEX(A1:A10,MATCH(TRUE,A1:A10<>0,1)) 'Last entry'

This code returns the value of the first cell that has data or the last cell that has data.

Thanks for your imput. It helped.
 
I missed, the "...that has data" qualification. Sorry.

That being stated, I would not have known that solution. Great tip worth at least one [purple]STAR[/purple]!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top