ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Row Number (https://www.excelbanter.com/excel-programming/329957-row-number.html)

Pradip Jain

Row Number
 
I have a range of dates in column A. i want to search for a date and return
its row number. What code should i use.
Suppose i want to know the row number of date 1/8/2002. Same is contained in
cell A9. The code should return 9.

Thanks
Pradip

Bob Phillips[_7_]

Row Number
 
=MATCH(--"2002-01-08",A1:A1000,0)

or if the test date in B1

=MATCH(B1,A1:A1000,0)

If in VBA

myVar = Application.MATCH(DateSerial(2005,1,8),Value,
Range("A1:A1000"),0)

myVar = Application.MATCH(Range("B1").Value, Range("A1:A1000"),0)



--
HTH

Bob Phillips

"Pradip Jain" wrote in message
...
I have a range of dates in column A. i want to search for a date and

return
its row number. What code should i use.
Suppose i want to know the row number of date 1/8/2002. Same is contained

in
cell A9. The code should return 9.

Thanks
Pradip





All times are GMT +1. The time now is 02:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com