+ Reply to Thread
Results 1 to 12 of 12

Issue with some numbers during VBA lookup, What should I look at?

  1. #1
    Registered User
    Join Date
    09-25-2022
    Location
    West Coast, USA
    MS-Off Ver
    365 - Version 2308
    Posts
    61

    Question Issue with some numbers during VBA lookup, What should I look at?

    I have a strange issue going on that I'm hoping someone might give me ideas on where to look to fix it. I can't post the actual document, so I've attached one that does the same thing as what I'm doing. (It works correctly in my example)

    I have a spreadsheet in calendar format that performs look ups using the days date as one of the references. It seemed to be working great except I just noticed an issue with certain dates in October. The dates are all coming from a query from the same source, and there are thousands, but I'm seeing just a few that are not populating as they should. They are the same format as the working numbers and I double checked with ISTEXT and converted them an extra time in Power Query just to be sure. If I manually add a new line with the same employee/date it doesn't work, but I sometimes when I add another employee with the same date, that date will work for them. Oddly, if I add more dates in October to the end of the data, it will suddenly populate two more of the October dates (but not the ones I entered). I tried adding 6 to see if I'd get more but it didn't even populate the two it had before.

    I know it's a long shot without being able to see the actual issue, but if anyone has any ideas for things to check, it would be greatly appreciated. There are thousands populating correctly, I just can't figure out what the deal is with these.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,364

    Re: Issue with some numbers during VBA lookup, What should I look at?

    Without an example of the "error" file we cannot offer a diagnosis and hence possible solution for any problem found..

    VBA only matches on ID and Date so unless either of these are"wrong" (extra space in ID ,etc) then it should work (as it does with the sample file).
    Last edited by JohnTopley; 10-06-2023 at 06:09 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,592

    Re: Issue with some numbers during VBA lookup, What should I look at?

    Anita Knapp,

    Your code is limitting dates between Sheet1!F3 and end of that month.
    So if you have dates in multiple months, it fails.

    try
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,364

    Re: Issue with some numbers during VBA lookup, What should I look at?

    @Jindon: why does it fail as we are only interested in dates ii row 3 (a given month) so these dates are selected. _ other month dates are ignored.????

  5. #5
    Registered User
    Join Date
    09-25-2022
    Location
    West Coast, USA
    MS-Off Ver
    365 - Version 2308
    Posts
    61

    Re: Issue with some numbers during VBA lookup, What should I look at?

    JohnTopley,

    Yeah, I thought it was probably a long shot. Initially I had figured it was an issue with the month sheet so I took a working month and changed the dates, but it does the same thing.

    Something I've just found.. If I add a fake person and add an entry in the data for the person for every day of the month, everything works (including the ones that weren't appearing before).

    I don't know if it's related, but earlier I was having an issue with all of the sheets where if there wasn't an entry for the 1st day of a month in the data sheet it would throw an error that there was a mismatch in the sRow line. Adding a fake entry for each 1st day fixed that.

    Adding: So I've added an entry for each day of the year, and it works. I don't really understand it because it's only certain dates that seem to impact it. For example, I removed a fake entry of 10/8 and it stopped working. Added it back but removed other dates (that don't appear under anyone else) and it stops again.

    Something I didn't think about was when there are two entries for someone in one date. It looks like it only sees the first one. Is there a way to highlight the cell or have a message pop up when it sees more than one?
    Last edited by Anita Knapp; 10-06-2023 at 02:11 PM.

  6. #6
    Registered User
    Join Date
    09-25-2022
    Location
    West Coast, USA
    MS-Off Ver
    365 - Version 2308
    Posts
    61

    Re: Issue with some numbers during VBA lookup, What should I look at?

    Hi Jindon,

    I've just tried this and it runs but nothing populates.

    I'm not sure if I understand what you're saying. There are multiple months in the data but each sheet being read only has one month.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,592

    Re: Issue with some numbers during VBA lookup, What should I look at?

    OK,
    I didn't know if the dates in sheet1 is just one month.
    However, your code is assuming data sheet MUST have the record that have date in Sheet1!F3. i.e Oct 1st 2023.

    Just change data!G13 from 2023/10/1 to 2023/10/2 and run your code.

    Code in post #3 runs fine for me.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-25-2022
    Location
    West Coast, USA
    MS-Off Ver
    365 - Version 2308
    Posts
    61

    Re: Issue with some numbers during VBA lookup, What should I look at?

    I must have something different in the real sheet, as this doesn't pull up anything either. Your explanation makes sense though. When I use the code I had and add all dates to the data, it works. If I have to, I'll just have some dummy data in the background. Thank you!

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,592

    Re: Issue with some numbers during VBA lookup, What should I look at?

    If you are talking about different data, no way to even guess...

  10. #10
    Registered User
    Join Date
    09-25-2022
    Location
    West Coast, USA
    MS-Off Ver
    365 - Version 2308
    Posts
    61

    Re: Issue with some numbers during VBA lookup, What should I look at?

    I think you did though, adding those dates fixes it. Is there any way to tweak the existing code to not require it? Along the same lines, is there a way to add something to the existing code that highlights the cell if there is more than one row that matches the ID and date?

    Thanks!

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,364

    Re: Issue with some numbers during VBA lookup, What should I look at?

    Please Login or Register  to view this content.
    Above checks for first date in the selected month i.e does NOT require a data of (for example) 01/10/2023 (1st October) in "Data"
    Last edited by JohnTopley; 10-09-2023 at 04:22 PM.

  12. #12
    Registered User
    Join Date
    09-25-2022
    Location
    West Coast, USA
    MS-Off Ver
    365 - Version 2308
    Posts
    61

    Re: Issue with some numbers during VBA lookup, What should I look at?

    Thank you for your time on this. All of the months are populating correctly except for October and January 2024. It's strange, what is missing depends on the "fake" entries, but it's not those "fake" dates missing. For example, removing the dummy 10/3 entry doesn't do anything but removing 10/17 makes it so none of the dummy dates populate. Removing the 16th and 17th, makes it so the dummy dates and a date off of another person don't populate.

    Adding.. I've just found that changing the order of the people makes a difference. If I move the person that's usually missing information up the list, it appears. It must be something with my sheet but I made the first sheet off the others that work and then made a new one. Any clue on what would cause that?
    Last edited by Anita Knapp; 10-09-2023 at 06:42 PM. Reason: Update

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Lookup Issue
    By jeeperv6 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-19-2018, 02:06 PM
  2. [SOLVED] Lookup issue
    By norm01 in forum Excel General
    Replies: 7
    Last Post: 05-14-2017, 01:40 AM
  3. Lookup Formula Issue, Search issue
    By kperitz in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-07-2014, 01:50 PM
  4. Issue Having Formula Recognizing Numbers Saved As Text As Numbers
    By livifivil in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-08-2013, 01:34 PM
  5. lookup issue
    By an63lu5 in forum Excel General
    Replies: 8
    Last Post: 05-02-2012, 09:51 PM
  6. Lookup issue
    By gfresh in forum Excel General
    Replies: 5
    Last Post: 07-19-2010, 07:36 AM
  7. LOOKUP issue
    By delboy2405 in forum Excel General
    Replies: 3
    Last Post: 10-26-2007, 05:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1