+ Reply to Thread
Results 1 to 4 of 4

Formula Help - Counting Blank Cells and Counting Number of Cells Since the Last Blank Cell

Hybrid View

  1. #1
    Registered User
    Join Date
    08-30-2018
    Location
    Texas
    MS-Off Ver
    Office 2016
    Posts
    2

    Formula Help - Counting Blank Cells and Counting Number of Cells Since the Last Blank Cell

    I have a table with 8 items that we sell. Each item has a code, which corresponds to the applicable pricing sale we have for that item, over a span of 8 time periods.

    I'm having trouble coming up with efficient formulas that will give me the answers that are in the orange-colored boxes.

    pic2.PNG

    This table has been simplified -- the true table I need formulas for has hundreds of various codes, and hundreds of periods, so simply doing a 8-step nested "if" statement won't really cut it in this particular project.

    I've attached the workbook so you can play around in it. The values in orange are the correct values, and are the cells I need formulas for.

    I appreciate any help I can get.
    Attached Files Attached Files

  2. #2
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,277

    Re: Formula Help - Counting Blank Cells and Counting Number of Cells Since the Last Blank

    I don't understand your logic. Can you simplify, how comes those values (In orange cells)


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  3. #3
    Registered User
    Join Date
    08-30-2018
    Location
    Texas
    MS-Off Ver
    Office 2016
    Posts
    2

    Re: Formula Help - Counting Blank Cells and Counting Number of Cells Since the Last Blank

    Sure.

    To help clarify, Period 1 is the most recent period. Period 8 was 8 periods (weeks/months) ago.

    Column B is the current code, which is easy -- Period 1 is the current period, so whatever is in that column is the current code

    Column C finds most recent non-zero code that was used, before the current non-zero code. So for example, for the 'Apple' item - The current code is 1, the most recent code that was not "code 1" was "code 2", back in period 4. Therefore, the answer is that "Code 2" was the prior non-zero code. For banana, the most recent non zero code change went from 2 to 1. Therefore, the prior non-zero code was code 2.

    Column D finds out when the last code change was. Any time the code changes - e.g. from 2 to 1, from 1 to 0(blank), etc., it's considered a code change. For apple, the last code change was from code 2 to code 1, in period 4. Therefore it has been 4 periods since the last code change. For banana, the last code change was from 1 to blank(0), in period 1, which means it has been 1 period since the code changed.

    I realize now that column E was too difficult to explain, so I have revised the table as such:
    pic3.PNG

    The new column E finds out many periods since there was a code. If there is currently a code, the answer is zero. If there has never been a code, like with Carrot, it counts all the periods.

    The new column F finds out how many periods since there was no code (a blank). If there is currently no code (blank), the answer is zero. If there has never been a code, like with Carrot, it counts all the periods.

    I've uploaded the revised workbook.

    Thanks for the help.
    Attached Files Attached Files

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Formula Help - Counting Blank Cells and Counting Number of Cells Since the Last Blank

    bubaseballfan, I am unable to follow your descriptions.

    The best I can do is find a pattern for column C. This in C3 and filled down returns the expected results.
    Formula: copy to clipboard
    =IF(COUNTBLANK(H3:O3)=8,"",INDEX(H3:O3,MATCH(1,INDEX(--(N(+H3:O3)>1),0),0)))
    Dave

+ 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. Counting blank cells up to first non-blank cell
    By DLG3 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-08-2015, 07:36 AM
  2. Ignore blank cells in formula counting number of different cells.
    By deneh in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-07-2015, 08:52 AM
  3. [SOLVED] repeat counting of blank cells till a cell with number/text
    By joshcct in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-03-2015, 03:33 AM
  4. [SOLVED] Counting number of non blank cells and inserting that amount on another sheet
    By cheeze83 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-20-2013, 05:39 AM
  5. counting the number of instances of blank cells in a range
    By moses67 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-01-2013, 10:35 AM
  6. Counting number of non-blank cells for every nth cell
    By mqp92 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 02-03-2013, 11:08 AM
  7. [SOLVED] Counting number of non-blank cells in column......but getting run time error in vba
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2012, 10:54 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