+ Reply to Thread
Results 1 to 11 of 11

A little complicated range selection

  1. #1
    Registered User
    Join Date
    03-18-2023
    Location
    Hrvatska
    MS-Off Ver
    2021
    Posts
    8

    A little complicated range selection

    Is it possible to create a formula in Excel that takes a certain sequence in the range that is repeated but according to the exactly selected sequence.
    I have a range of 30 days per month from A1 to U1. Cells are filled with days that start randomly, eg: Wed, Thu, Fri, Sat, Sun, Mon, Tue, Wed, Thu, Fri, Sat, Sun, Mon, Tue, and so in 30 days.
    1. Below in A21 to U2 I have values that I want, for only example, to SUM, but according to the criterion that only those cells from the top row that are in the range from Mon to Sun, that means the whole week, so it skips if the row starts from Wed, or end in middle day of week, but it searches for the whole week .
    2. When it finds the first whole sequence Mon to Sun, it calculates it, then it searches for the next sequence Mon to Sun, calculates that and then the next sequence if there is one.

    I know it sounds a bit complicated, but that's why I can't figure it out myself.

    Example in attachment
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: A little complicated range selection

    All are ARRAY functions.
    First. In B12
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    SECOND. In I12
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    THIRD. In P12
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    To enter ARRAY formula
    Copy and paste the formula in cell
    Press F2
    Press Ctrl+Shift+Enter together
    Excel covers the formula with {}.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: A little complicated range selection

    the sample is a little confusing and you infer you have multiple rows to aggregate, 30 days (but only 21 columns) but, perhaps something along the lines of:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    the above would aggregate the numbers associated with "complete" weeks, in this example that would be columns C:P inclusive.
    refer A17 in sample -- uploaded to account for {potential} locale differences re: delimiters

    edit: typo in above, corrected (and updated attachment) @ 06:46 UK
    Attached Files Attached Files
    Last edited by XLent; 03-22-2023 at 02:46 AM.

  4. #4
    Registered User
    Join Date
    03-18-2023
    Location
    Hrvatska
    MS-Off Ver
    2021
    Posts
    8

    Re: A little complicated range selection

    Thanks guys.
    kvsrinivasamurthy your is kind of .
    XLent your is close what i want.

    But my mistake that i didn't be precise.
    Here is example of formula i made by hand and what i need.

    keep in mind that Excel is in Croatian and the time format is 24 hours, but that shouldn't be a problem
    Attached Files Attached Files

  5. #5
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: A little complicated range selection

    so, still assuming the start day will vary (from one month to the next) see if the attached [N6] works for you (returns 8 using row 2)

    this now assumes you're calculating Overtime (or equivalent) row by row

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    however, this does feel like a "sledgehammer" approach; you might be better off just storing wk 1-4 totals in separate columns, based on first Mon (such that sometimes wk 4 is 0), as this will be more intuitive
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-18-2023
    Location
    Hrvatska
    MS-Off Ver
    2021
    Posts
    8

    Re: A little complicated range selection

    Quote Originally Posted by XLent View Post
    so, still assuming the start day will vary (from one month to the next) see if the attached [N6] works for you (returns 8 using row 2)

    this now assumes you're calculating Overtime (or equivalent) row by row

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    however, this does feel like a "sledgehammer" approach; you might be better off just storing wk 1-4 totals in separate columns, based on first Mon (such that sometimes wk 4 is 0), as this will be more intuitive
    Problem is with 10 or more people in schedules in whole year. Like i said in example i can do by hand but i just want to see is there way if i change days for all month that it will do automatically.

  7. #7
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: A little complicated range selection

    Pl see file. All formulas are in file.
    Attached Files Attached Files

  8. #8
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: A little complicated range selection

    Like i said in example i can do by hand but i just want to see is there way if i change days for all month that it will do automatically.
    well, as mentioned, I'd suggest taking a look at the previously provided suggestion(s) to see if they meet your requirements. However, I'd simply add that you need to be careful of adopting elegance over practicality, particularly when simple approaches are likely to be quick and easy(ier) to maintain.

  9. #9
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: A little complicated range selection

    Some months there may be 4 weeks. Formulas are given for 4 weeks. Pl see file.
    In F11 copied up to I12
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    NOTE: KEEP ALWAYS AE2 BLANK
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 03-23-2023 at 04:21 AM.

  10. #10
    Registered User
    Join Date
    03-18-2023
    Location
    Hrvatska
    MS-Off Ver
    2021
    Posts
    8

    Re: A little complicated range selection

    Quote Originally Posted by kvsrinivasamurthy View Post
    Some months there may be 4 weeks. Formulas are given for 4 weeks. Pl see file.
    In F11 copied up to I12
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    NOTE: KEEP ALWAYS AE2 BLANK
    Exactly, thanks a lot for the help, I'll try that and put it in my table.

  11. #11
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: A little complicated range selection

    Pl mark the thread 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. Replies: 3
    Last Post: 08-20-2021, 05:52 PM
  2. Complicated tracking sheet for shift selection and availability
    By ricunger in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-30-2014, 02:37 PM
  3. [SOLVED] Range(Selection, Selection.End(xlDown)).Select goes to 65536 instead of last filled row
    By looney in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-12-2013, 10:51 AM
  4. [SOLVED] Complicated Data Selection
    By Excel Dumbo in forum Excel General
    Replies: 2
    Last Post: 05-13-2013, 09:33 PM
  5. Complicated VBA change to text Selection.AutoFill Excel 2007
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-27-2012, 12:19 PM
  6. Complicated vlookup with range values
    By jcaps in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 11-05-2012, 09:21 PM
  7. Replies: 2
    Last Post: 04-20-2012, 12:23 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