Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
plf100
 
Posts: n/a
Default Select cell containing specific text &return value from another ce

How do I find a cell in a row which contains a specific text string and
return a value (also a text string) from another cell in the same column?

For example: Can I search for first cell in Row 2 that contains the text
"Gate 1" and return the value "APR" from same column but different row?
Similarly, search for cell in Row 3 that contains "Gate 1" and return "MAY".

Col A Col B Col C
Row 1 APR MAY JUN
Row 2 Gate 1 Gate 3
Row 3 Gate 1

Thanks in advance,
Pam



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Duke Carey
 
Posts: n/a
Default Select cell containing specific text &return value from another ce

You would use the MATCH() function to find the position of the first value in
the row that matches your criteria. Like so:

=MATCH("Gate 1",A2:L2,0)

Use the results of the MATCH() function in an INDEX() function to determine
which header value to retrieve, like this

=INDEX($A$1:$L$1,1,MATCH("Gate 1",A2:L2))

"plf100" wrote:

How do I find a cell in a row which contains a specific text string and
return a value (also a text string) from another cell in the same column?

For example: Can I search for first cell in Row 2 that contains the text
"Gate 1" and return the value "APR" from same column but different row?
Similarly, search for cell in Row 3 that contains "Gate 1" and return "MAY".

Col A Col B Col C
Row 1 APR MAY JUN
Row 2 Gate 1 Gate 3
Row 3 Gate 1

Thanks in advance,
Pam



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
plf100
 
Posts: n/a
Default Select cell containing specific text &return value from anothe

Thanks Duke, thats exactly what I needed.

Would I be able to include an IF() statement somewhere so that if none of
the cells in the row contain the text "Gate 1" then it would return a blank
("") rather than an error message?

"Duke Carey" wrote:

You would use the MATCH() function to find the position of the first value in
the row that matches your criteria. Like so:

=MATCH("Gate 1",A2:L2,0)

Use the results of the MATCH() function in an INDEX() function to determine
which header value to retrieve, like this

=INDEX($A$1:$L$1,1,MATCH("Gate 1",A2:L2))

"plf100" wrote:

How do I find a cell in a row which contains a specific text string and
return a value (also a text string) from another cell in the same column?

For example: Can I search for first cell in Row 2 that contains the text
"Gate 1" and return the value "APR" from same column but different row?
Similarly, search for cell in Row 3 that contains "Gate 1" and return "MAY".

Col A Col B Col C
Row 1 APR MAY JUN
Row 2 Gate 1 Gate 3
Row 3 Gate 1

Thanks in advance,
Pam



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Duke Carey
 
Posts: n/a
Default Select cell containing specific text &return value from anothe

=if(isna(INDEX($A$1:$L$1,1,MATCH("Gate
1",A2:L2,0))),"",INDEX($A$1:$L$1,1,MATCH("Gate 1",A2:L2,0)) )

should do it


"plf100" wrote:

Thanks Duke, thats exactly what I needed.

Would I be able to include an IF() statement somewhere so that if none of
the cells in the row contain the text "Gate 1" then it would return a blank
("") rather than an error message?

"Duke Carey" wrote:

You would use the MATCH() function to find the position of the first value in
the row that matches your criteria. Like so:

=MATCH("Gate 1",A2:L2,0)

Use the results of the MATCH() function in an INDEX() function to determine
which header value to retrieve, like this

=INDEX($A$1:$L$1,1,MATCH("Gate 1",A2:L2))

"plf100" wrote:

How do I find a cell in a row which contains a specific text string and
return a value (also a text string) from another cell in the same column?

For example: Can I search for first cell in Row 2 that contains the text
"Gate 1" and return the value "APR" from same column but different row?
Similarly, search for cell in Row 3 that contains "Gate 1" and return "MAY".

Col A Col B Col C
Row 1 APR MAY JUN
Row 2 Gate 1 Gate 3
Row 3 Gate 1

Thanks in advance,
Pam



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
plf100
 
Posts: n/a
Default Select cell containing specific text &return value from anothe

Many thanks for your help Duke.

"Duke Carey" wrote:

=if(isna(INDEX($A$1:$L$1,1,MATCH("Gate
1",A2:L2,0))),"",INDEX($A$1:$L$1,1,MATCH("Gate 1",A2:L2,0)) )

should do it


"plf100" wrote:

Thanks Duke, thats exactly what I needed.

Would I be able to include an IF() statement somewhere so that if none of
the cells in the row contain the text "Gate 1" then it would return a blank
("") rather than an error message?

"Duke Carey" wrote:

You would use the MATCH() function to find the position of the first value in
the row that matches your criteria. Like so:

=MATCH("Gate 1",A2:L2,0)

Use the results of the MATCH() function in an INDEX() function to determine
which header value to retrieve, like this

=INDEX($A$1:$L$1,1,MATCH("Gate 1",A2:L2))

"plf100" wrote:

How do I find a cell in a row which contains a specific text string and
return a value (also a text string) from another cell in the same column?

For example: Can I search for first cell in Row 2 that contains the text
"Gate 1" and return the value "APR" from same column but different row?
Similarly, search for cell in Row 3 that contains "Gate 1" and return "MAY".

Col A Col B Col C
Row 1 APR MAY JUN
Row 2 Gate 1 Gate 3
Row 3 Gate 1

Thanks in advance,
Pam



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select specific cell Shawn Excel Discussion (Misc queries) 1 April 28th 05 09:00 PM
Wrap text limits in Excel 2003 cell formatting Adelrose Excel Discussion (Misc queries) 1 April 19th 05 06:32 PM
Help inserting a Cell Value in a Text Cell Dave Excel Worksheet Functions 5 March 5th 05 09:06 PM
Autofitting a row Josephine Excel Discussion (Misc queries) 2 March 3rd 05 03:37 PM
Conversion SVC Excel Worksheet Functions 9 February 28th 05 02:29 PM


All times are GMT +1. The time now is 05:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"