+ Reply to Thread
Results 1 to 17 of 17

weekend and weekday formulas

  1. #1
    Registered User
    Join Date
    11-12-2017
    Location
    ODESSA, UKRAINE
    MS-Off Ver
    Office Macos
    Posts
    13

    weekend and weekday formulas

    Hello,
    I have a problem with WEEKEND and WEEKDAY formulas. I am trying 2 different DATE formats on my sheet, but I couldn't choose the exact weekend days. I am sending some screenshots about my problem. I have tried many times, but formula takes the wrong data format and colors the weekend days differently.

    Here I used one USA data format and the second is Turkish date format. You can see the dates top in the command line. Both of them selects the wrong weekend days. And some cells haven't date, it colors it too. And when I use WEEKEND and WEEKDAY formulas with input like this $D$10, it doesn't do anything. When I write it like this $D10, it colors some of them. But not right. It selects that if the date 11/03/2017, March 11, 2017. But I have tried it with Turkish date format too.

    I don't understand why it is like that? Does anyone understand my problem and where did I wrong?

    Thanks for your interest.
    Attached Images Attached Images

  2. #2
    Registered User
    Join Date
    11-12-2017
    Location
    ODESSA, UKRAINE
    MS-Off Ver
    Office Macos
    Posts
    13

    Re: weekend and weekday formulas

    here are the date formats.
    Attached Images Attached Images

  3. #3
    Registered User
    Join Date
    11-12-2017
    Location
    ODESSA, UKRAINE
    MS-Off Ver
    Office Macos
    Posts
    13

    Re: weekend and weekday formulas

    This is what I see.
    Attached Images Attached Images

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: weekend and weekday formulas

    Can you upload a sample workbook using the problem data? (so we don't have to waste time re-creating your spreadsheet)

    To attach a workbook:
    Click Edit Post (or just start a new reply.)
    Click Go Advanced
    Scroll down to Manage Attachments and click.
    Now click Browse, find your file, then click Upload. Simple!
    Last edited by leelnich; 11-12-2017 at 11:21 AM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  5. #5
    Registered User
    Join Date
    11-12-2017
    Location
    ODESSA, UKRAINE
    MS-Off Ver
    Office Macos
    Posts
    13

    Re: weekend and weekday formulas

    I have sent it.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    514

    Re: weekend and weekday formulas

    Try

    =AND(WEEKDAY($C1,2)>5,$C1<>"")

  7. #7
    Registered User
    Join Date
    11-12-2017
    Location
    ODESSA, UKRAINE
    MS-Off Ver
    Office Macos
    Posts
    13

    Re: weekend and weekday formulas

    thanks for your interest. that works. could you please tell me why that happened? what was my problem? and how did you solve this problem? I just want to understand my problem. thanks a lot.

  8. #8
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    514

    Re: weekend and weekday formulas

    You applied a CF rule, which references $C4, to range $C$1:$C$xx. As a result, you got a 3-row shift.

    The $C1<>"" part is needed to avoid highlighting blank cells.
    Last edited by Root_; 11-12-2017 at 12:25 PM.

  9. #9
    Registered User
    Join Date
    11-12-2017
    Location
    ODESSA, UKRAINE
    MS-Off Ver
    Office Macos
    Posts
    13

    Re: weekend and weekday formulas

    great! thanks for your explanation. have a nice day.

  10. #10
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: weekend and weekday formulas

    Quote Originally Posted by Root_ View Post
    =AND(WEEKDAY($C1,2)>5,$C1<>"")
    This works for column C (by ignoring empty cells), but column D has additional problems. Some of the entries are numbers, others are text that looks like numbers. Excel mistakenly assigns a datevalue of 0 (= 1/0/1900 = a Saturday!) to text and blanks, so the text must be converted. Select Column D, then click Text to Columns on the Data tab. Select Fixed Width, then click NEXT twice to move to Step 3 of the wizard (Data Format). Select Date, then click the drop-down arrow and select DMY. Now click Finish. All text should now be numbers, which Excel can handle properly.

    ps, you must also insure that the Conditional Formatting formula for column D aligns with its Applies to range. If the first cell is D4, then the formula must read =WEEKDAY($D4,2)>5.
    Last edited by leelnich; 11-12-2017 at 12:49 PM.

  11. #11
    Registered User
    Join Date
    11-12-2017
    Location
    ODESSA, UKRAINE
    MS-Off Ver
    Office Macos
    Posts
    13

    Re: weekend and weekday formulas

    thansk a lot guys. that formula worked for me.

  12. #12
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: weekend and weekday formulas

    Happy to help! If that concludes your thread, please got to Thread Tools (up top) and mark it as SOLVED. Thanks! - Lee

  13. #13
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    514

    Re: weekend and weekday formulas

    @ leelnich:

    Just to mention: WEEKDAY works for both dates-as-numbers and dates-as-strings.
    For non-date strings, it returns a #VALUE!. So, there was no need to convert anything.

  14. #14
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: weekend and weekday formulas

    Quote Originally Posted by Root_ View Post
    ...For non-date strings, it returns a #VALUE!...
    - and therein lies the problem. It's not about the formula, it's about how Excel struggles with the D/M/Y date format, even though the cells in question have a Regional number format that supports it. Any date that falls after the 12th of a month is incorrectly treated as straight text, not as a date, so the CF formula FAILS for them. Please see the attached workbook for clarification of the issue.
    Attached Files Attached Files
    Last edited by leelnich; 11-13-2017 at 05:31 PM.

  15. #15
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,726

    Re: weekend and weekday formulas

    Hello Lee,

    I suspect this will depend on regional settings. Conditional formatting works for me in your attachment , e.g. D17 is formatted as expected because 16th September 2017 was a Saturday......but my default date format is dd/mm/yyyy so, as Root_ says WEEKNUM will correctly interpret that as a date (even when text formatted) assuming it's a valid date based on your regional settings.

    I understand that Ukraine also uses dd/mm/yyyy so it might work OK for oxcor too
    Audere est facere

  16. #16
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: weekend and weekday formulas

    Noted! I've seen a lot of threads about formatting issues (especially dates) complicated by different regional settings. I usually use "11 Nov 2017" to save on confusion. For the sake of completeness, here's a screenshot showing the data as I saw it.Untitled.png
    Last edited by leelnich; 11-13-2017 at 06:43 PM.

  17. #17
    Registered User
    Join Date
    11-12-2017
    Location
    ODESSA, UKRAINE
    MS-Off Ver
    Office Macos
    Posts
    13

    Re: weekend and weekday formulas

    thanks for your explanation. that's all clear now.

+ 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] Weekday/Weekend Formula
    By nmckever in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-19-2017, 04:36 PM
  2. [SOLVED] Convert date to weekday or weekend
    By RookA1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-15-2017, 01:09 PM
  3. [SOLVED] Have VBA Identify if it is a weekend or weekday
    By jdoerr1021 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-17-2016, 06:37 PM
  4. [SOLVED] Weekday/Weekend count from table
    By Mechanical Pencil in forum Excel General
    Replies: 3
    Last Post: 02-13-2016, 02:20 PM
  5. Average Last 7 Days by Weekday/Weekend
    By cleone1387 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-28-2014, 01:32 PM
  6. [SOLVED] Calculate Overtime Weekday different from Weekend
    By Lg101 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-07-2014, 04:41 PM
  7. [SOLVED] help please to identify and display 'WEEKDAY' or 'WEEKEND'
    By vin1602 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-06-2013, 06:30 AM

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