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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return a value from a row in Excel

Status
Not open for further replies.

RFeniuk

Technical User
May 7, 2003
20
IN
I am looking for some help in the formula to have Excel return the value from another sheet that is in the cell prior to a specific event.

i.e. return the value from the array "C1:Z1" of "Sheet 1" that is in the cell prior to the first occurance of "na"

I appreciate everyones help on this.

Thanks
Ron
 
Not sure exactly what you are looking for but this code will return the value of the cell next to "na" as in you example.
Sub FindCellValue()

Sheets("Sheet1").Select
Range("C1:Z1").Select

Selection.Find(What:="na", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
MsgBox ActiveCell.Offset(0, -1)


End Sub

Just change "Sheet1" to the sheet that your data is in.

HTH,
Eric
 
Try this:
[blue]
Code:
  =INDEX(Sheet1!C1:Z1,1,MATCH("na",Sheet1!C1:Z1,0)-1)
[/color]

 
Thank you very much to Zathras and Skip for your advice. That is exactly what I was looking for. A big star to both of you.

Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top