Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default MATCH an unknown number

I need to find the location of the first cell in a row containing a number.
(Cells that are not numbers are #N/A, #VALUE!, or #REF! errors).

For instance, I need to look in B55:IV55 to find the location of the first
number, left-to-right. If the first number is in B55 I want a 1, or if it's
in C55 I want a 2, or if it's in D55 I want a 3, etc.. How can I use MATCH
(or any other function) to return the relative cell location if it there can
be any number in the cell?

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default MATCH an unknown number

One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):

=MATCH(TRUE,ISNUMBER(B55:IV55),FALSE)

However, I'd also recommend trapping those errors - in general leaving
"expected" errors is a bad idea - it leads to missing real logic,
business or data entry errors.



In article ,
ut_libet wrote:

I need to find the location of the first cell in a row containing a number.
(Cells that are not numbers are #N/A, #VALUE!, or #REF! errors).

For instance, I need to look in B55:IV55 to find the location of the first
number, left-to-right. If the first number is in B55 I want a 1, or if it's
in C55 I want a 2, or if it's in D55 I want a 3, etc.. How can I use MATCH
(or any other function) to return the relative cell location if it there can
be any number in the cell?

Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default MATCH an unknown number

Try this small User Defined Function:

Function firstnumber(r As Range) As Integer
firstnumber = 1
For Each rr In r
If Not IsEmpty(rr) Then
If IsNumeric(rr.Value) Then Exit Function
End If
firstnumber = firstnumber + 1
Next
firstnumber = 0
End Function

Use it in the worksheet like:
=firstnumber(B55:IV55)

It will ignore blanks, errors, and Text
--
Gary''s Student - gsnu200791


"ut_libet" wrote:

I need to find the location of the first cell in a row containing a number.
(Cells that are not numbers are #N/A, #VALUE!, or #REF! errors).

For instance, I need to look in B55:IV55 to find the location of the first
number, left-to-right. If the first number is in B55 I want a 1, or if it's
in C55 I want a 2, or if it's in D55 I want a 3, etc.. How can I use MATCH
(or any other function) to return the relative cell location if it there can
be any number in the cell?

Thanks in advance.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default MATCH an unknown number

Thank you very much! This was exactly the formula I needed.

And yes, I'll do my best to work around creating those errors.



"JE McGimpsey" wrote:

One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):

=MATCH(TRUE,ISNUMBER(B55:IV55),FALSE)

However, I'd also recommend trapping those errors - in general leaving
"expected" errors is a bad idea - it leads to missing real logic,
business or data entry errors.



In article ,
ut_libet wrote:

I need to find the location of the first cell in a row containing a number.
(Cells that are not numbers are #N/A, #VALUE!, or #REF! errors).

For instance, I need to look in B55:IV55 to find the location of the first
number, left-to-right. If the first number is in B55 I want a 1, or if it's
in C55 I want a 2, or if it's in D55 I want a 3, etc.. How can I use MATCH
(or any other function) to return the relative cell location if it there can
be any number in the cell?

Thanks in advance.


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
Unknown number format Don Excel Worksheet Functions 1 September 20th 06 06:17 PM
Formula's dealing with unknown number of rows OfficeNDN Excel Discussion (Misc queries) 2 September 11th 06 04:11 PM
How can I match a random number with closest number from sequence? Matt Excel Worksheet Functions 4 August 3rd 06 01:22 AM
Dividing by unknown to get a number bundyloco Excel Worksheet Functions 5 August 14th 05 03:44 PM
How to Calculate an unknown number? Beau Excel Worksheet Functions 1 May 28th 05 01:20 AM


All times are GMT +1. The time now is 07:36 AM.

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"