+ Reply to Thread
Results 1 to 17 of 17

Counting Blank Cells from Right to Left

  1. #1
    Registered User
    Join Date
    11-13-2015
    Location
    Vancouver, Canada
    MS-Off Ver
    2013
    Posts
    29

    Counting Blank Cells from Right to Left

    I have a schedule that has a flag for every day off, displaying a 1. If they worked, the cell returns "".
    I need to count how many days each employee worked ("" cells) consecutively from Sunday and working backwards.
    Basically, I need to make sure people are not working too many consecutive days over two schedules.

    M T W T F S S
    1 1 3
    1 1 1 1 1 1 1 0
    1 1 1

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Counting Blank Cells from Right to Left

    Try this in H2:

    =COLUMNS(A2:G2)-MATCH(9.99E+307,A2:G2)

  3. #3
    Forum Expert dosydos's Avatar
    Join Date
    12-09-2015
    Location
    Massachusetts
    MS-Off Ver
    365(PC) V:2308
    Posts
    1,474

    Re: Counting Blank Cells from Right to Left

    this should work

    -deleted-

    EDIT: same answer as above.
    Last edited by dosydos; 12-20-2018 at 03:50 PM.

  4. #4
    Registered User
    Join Date
    11-13-2015
    Location
    Vancouver, Canada
    MS-Off Ver
    2013
    Posts
    29

    Re: Counting Blank Cells from Right to Left

    Awesome, this works great! Thank you.

    (how/why does this work?)

  5. #5
    Registered User
    Join Date
    11-13-2015
    Location
    Vancouver, Canada
    MS-Off Ver
    2013
    Posts
    29

    Re: Counting Blank Cells from Right to Left

    Follow-up question;

    How would I do the exact same thing, but this time counting from left to right?

  6. #6
    Forum Expert dosydos's Avatar
    Join Date
    12-09-2015
    Location
    Massachusetts
    MS-Off Ver
    365(PC) V:2308
    Posts
    1,474

    Re: Counting Blank Cells from Right to Left

    MATCH(9.99E+307,A2:G2)

    more specifically 9.99E+307 is the largest number in excel. Match uses this to find the last number in the array and returns its relative position. then it is just simple math of total column - relative position.

  7. #7
    Forum Expert dosydos's Avatar
    Join Date
    12-09-2015
    Location
    Massachusetts
    MS-Off Ver
    365(PC) V:2308
    Posts
    1,474

    Re: Counting Blank Cells from Right to Left

    AND FOR LEFT TO RIGHT YOU CAN USE AN ARRAY FORMULA. Enter with ctrl + shift + enter


    =INDEX(COLUMN(A2:G2),,MIN(IF(A2:G2<>"",COLUMN(A2:G2),9.99E+307)))-1

  8. #8
    Registered User
    Join Date
    11-13-2015
    Location
    Vancouver, Canada
    MS-Off Ver
    2013
    Posts
    29

    Re: Counting Blank Cells from Right to Left

    This returns #REF!
    Last edited by AliGW; 12-21-2018 at 09:13 AM.

  9. #9
    Forum Expert dosydos's Avatar
    Join Date
    12-09-2015
    Location
    Massachusetts
    MS-Off Ver
    365(PC) V:2308
    Posts
    1,474

    Re: Counting Blank Cells from Right to Left

    did you use ctrl shift and enter?
    it should ad { } around the formula

  10. #10
    Registered User
    Join Date
    11-13-2015
    Location
    Vancouver, Canada
    MS-Off Ver
    2013
    Posts
    29

    Re: Counting Blank Cells from Right to Left

    Yes, still doesn't work
    Last edited by AliGW; 12-21-2018 at 09:13 AM.

  11. #11
    Forum Expert dosydos's Avatar
    Join Date
    12-09-2015
    Location
    Massachusetts
    MS-Off Ver
    365(PC) V:2308
    Posts
    1,474

    Re: Counting Blank Cells from Right to Left

    I attatched the sheet i made with the formula in yellow cells.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    11-13-2015
    Location
    Vancouver, Canada
    MS-Off Ver
    2013
    Posts
    29

    Re: Counting Blank Cells from Right to Left

    Yes, your one works great, but when I copy the formula, change the range/reference and ctrl+shift+enter i still get #REF!
    Last edited by AliGW; 12-21-2018 at 09:14 AM.

  13. #13
    Registered User
    Join Date
    11-13-2015
    Location
    Vancouver, Canada
    MS-Off Ver
    2013
    Posts
    29

    Re: Counting Blank Cells from Right to Left

    =index(column(ak4:aq4),,min(if(ak4:aq4<>"",column(ak4:aq4),9.99e+307)))-1

  14. #14
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Counting Blank Cells from Right to Left

    This should work for left to right:

    =MATCH(1,A2:G2,0)-1

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,222

    Re: Counting Blank Cells from Right to Left

    Bl1nd - please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  16. #16
    Registered User
    Join Date
    11-13-2015
    Location
    Vancouver, Canada
    MS-Off Ver
    2013
    Posts
    29

    Re: Counting Blank Cells from Right to Left

    Thanks 63falcondude!

  17. #17
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Counting Blank Cells from Right to Left

    You're welcome. Happy to help.

    Merry Christmas!

+ 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-30-2018, 11:13 PM
  2. Replies: 12
    Last Post: 05-29-2018, 05:11 PM
  3. How can I make multiple cells mandatory if new rows are used with some cells left blank?
    By markbarnett in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-11-2015, 07:06 AM
  4. Replies: 2
    Last Post: 11-22-2013, 01:07 PM
  5. Counting empty cells to the left
    By Befuddled in forum Excel General
    Replies: 13
    Last Post: 09-24-2009, 12:27 AM
  6. Replies: 0
    Last Post: 08-23-2005, 03:43 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