Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Application.Match with Times

Hello,

Why not round the value AND the searched ranged?

Sub TimesAgain()
Dim C As Range
Dim rng As Variant
Dim TimeToFind As Double
Dim res As Variant

rng = Evaluate("=Transpose(ROUND(times,6))") ' Done once

For Each C In Range("A10:F10") ' ajust for the searched values
TimeToFind = Round(C, 6)
res = Application.Match(TimeToFind, rng, 0)
' here do something more meaningful
Debug.Print C.Address, IIf(IsError(res), "Not matched", res)
Next C

End Sub

Regards,

Daniel M.

"Patrick Molloy" wrote in message
...
The issue is most likely because time is saved internally
as decimal part of a day. so 14:30 is 14.5 hoyrs or
14.5/24 = 0.6041666 recurring

You might consider entering th etime in the lookup column
as text ? ie '14:30
not ideal I'm afraid.

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
I've been at this problem for a while now, and could not
find any guidance in previous posts.

I have a range 6 X 10 of times that coorespond to a
schedule.
Start Break MealStart MealStop Break End
10:30 AM 12:00 PM 2:30 PM 3:30 PM 5:00 PM
7:00 PM

I then have a single row of times from midnight to 11:45
PM, in incriments
of 15 minutes.
12:00 AM 12:15 AM 12:30 AM 12:45 AM 1:00
AM etc

I am writing a macro that will iterate cell by cell
through the schedule
times and return the cooresponding column number

matching
the time in the
single row (range named as "times").

Dim rng as Range
Dim TimeToFind as Double
Dim res as Variant
Dim CurRow, CurCol as Integer

CurCol = 1
CurRow = 1
Set rng = Range("times")
TimeToFind = CDbl(Cells(CurRow, CurCol))
res = Application.Match(TimeToFind, rng, 0)

Certain times are not being found, despite that they are
clearly there! It
has no trouble finding 10:30 AM (serial: 0.4375), or

12:00
PM (serial: 0.5).
It pukes on 2:30 PM.

Can anyone shed some light on this or point me in the
right direction?
Thanks for your assistance!


.



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
application.match and value problem Cbrehm Excel Discussion (Misc queries) 0 February 12th 11 04:34 PM
Office application version does not match. Joy Excel Discussion (Misc queries) 0 February 16th 09 01:22 PM
application.match Chip Smith Excel Discussion (Misc queries) 3 March 30th 06 08:56 PM
Application.WorksheetFunction.Match problem Carl Brehm Excel Worksheet Functions 1 January 9th 05 02:08 PM
Application.Match with Times Pat[_12_] Excel Programming 0 January 11th 04 02:16 AM


All times are GMT +1. The time now is 11:45 PM.

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

About Us

"It's about Microsoft Excel"