+ Reply to Thread
Results 1 to 10 of 10

Error handling (check if the cell is current week)

  1. #1
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Error handling (check if the cell is current week)

    Hi, im doing an error handling to my project. I get some problems :/:

    On sheet 1 there is a table that is being downloaded in a scheme that You see.

    A) I need to check if a date in cell (28,14) - 15.2013 is a current week.
    B) The problem is that this cell is number stored as text :/
    C) Second problem is that when the week will be first of the year or second etc. It will show as 1.2013 and 2.2013 (because i wanted to use "Left(Cells(28,14),2)"

    If my problem is not clear enough tell me and i will explain further
    Attached Files Attached Files
    Last edited by mumsys; 08-05-2013 at 06:36 AM.

  2. #2
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Error handling (check if the cell is current week)

    How you decide month in case its 23.2013
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Error handling (check if the cell is current week)

    You can also make the current week as text and then compare them.

    How you gonna compare them.

    If it isn't text, what would be in the cell to your opinion.

    15.2013 (format as genareal)?
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: Error handling (check if the cell is current week)

    Thx for the answers.
    Debraj Roy, i dont decide which month. In this case today would be 32 week of a year. This example has some old weeks in it
    So it should be a workbook downloaded from week 32 to week 41 and my macro need to check if the current week (32) is the same in cell (28,14)

    Oeldere, so Youre saying there is no difference if its number stored as text? I thought that this would be an issue.

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Error handling (check if the cell is current week)

    if you make the current week as text, it will find the current week with text in your file. (since the format is equal).

    maybe that's not the best solution, but then we have to know what you gonna do with your file.

    compare (how) / all cells / one cell etc.

  6. #6
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Error handling (check if the cell is current week)

    Try this...

    Please Login or Register  to view this content.
    which will try to convert..

    15.2013 to 15 AUG 2013
    and dateValue will convert 15 AUG 2013 to actual Date.. like 41501
    and then a you can go for WeekNum Test..

    Hope you can able to adjust Cells(28,14) with I,J and loop..

    Try and confirm..

  7. #7
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: Error handling (check if the cell is current week)

    compare only one cell (28,14) because if this is right all of the rest would be right.

    The problem is that if i define as string -
    Please Login or Register  to view this content.
    it will show 32.2013 and then compare with the cell (28,14) it will be ok.
    But if the current_week would be on the beginning of the year it would be current_week = 01.2013 (and in the report i will have 1.2013 - so it would be an error).

  8. #8
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: Error handling (check if the cell is current week)

    Debraj Roy, thank You that managed to challenge my issue

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Error handling (check if the cell is current week)

    In that case you have to check the length of the cells (normaly 7, in the beginning of the year 6 characters).

  10. #10
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Error handling (check if the cell is current week)

    15.2013 to 15 AUG 2013
    and dateValue will convert 15 AUG 2013 to actual Date.. like 41501
    In above case.. it will also take care.. if date is 01 / 1 / 11..

    and thanks for the rep & feedback.. Mark as solved.. if solved..

+ 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. Chart previous week data as grouped and current week as ungrouped
    By r_a_c_a_4_u in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-17-2013, 12:55 PM
  2. Macro to sort an activity sheet by current week and current + last 1 and 2 weeks
    By engineering_excel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-13-2011, 11:28 AM
  3. Replies: 4
    Last Post: 03-21-2011, 05:37 PM
  4. Handling error in formula with blank cell?
    By Chantel1326 in forum Excel General
    Replies: 3
    Last Post: 10-09-2008, 08:02 PM
  5. Cell To Show Current Week No.
    By TM-Scotland in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-13-2007, 04:17 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