+ Reply to Thread
Results 1 to 7 of 7

Ignore blank cells in Excel INDEX formula

  1. #1
    Registered User
    Join Date
    06-18-2022
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    8

    Ignore blank cells in Excel INDEX formula

    I'm using an Excel INDEX formula (below) to pull data from the last 4 columns in a range and average them, but I need to be able to add columns to my data set later without adjusting the formula, meaning I set the range much bigger (D3:CY3) than I currently have data in (D3:AA3). That way when someone in my office adds data to cell AB3, the last 4 columns in the formula will be Y, Z, AA, AB instead of X, Y, Z, AA. This means I need the formula to ignore (not count as part of the last 4 columns) any that are blank. Can this be done? Thanks!

    =AVERAGE(INDEX('2022'!D3:CY3,0,COLUMNS('2022'!D3:CY3)-(4-1)):INDEX('2022'!D3:CY3,0,COLUMNS('2022'!D3:CY3)))

    Originally posted on stackoverflow.com with no responses. Attempted to post link to it here as instructed, but new members are not permitted to post links apparently. *shrug*
    Attached Files Attached Files
    Last edited by Rolaids24; 06-18-2022 at 11:15 AM.

  2. #2
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: Ignore blank cells in Excel INDEX formula

    Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. For a new thread (1st post), scroll to Manage Attachments, otherwise scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Ignore blank cells in Excel INDEX formula

    Hi Rolaids,

    I think you can use a CountA function to get the number of non blank cells and use it in an offset function.. See the attached.
    Average of Last 4 in a Row using CountA.xlsx

    If my example doesn't match you problem then give us a sample workbook showing what you have.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    06-18-2022
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Ignore blank cells in Excel INDEX formula

    Attached sample
    Last edited by AliGW; 06-18-2022 at 12:11 PM. Reason: pl

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Ignore blank cells in Excel INDEX formula

    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-18-2022
    Location
    Ohio
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Ignore blank cells in Excel INDEX formula

    Quote Originally Posted by Fluff13 View Post
    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    That did it, thank you!

    And thank you to MarvinP as well, your solution works too! Appreciate everyone's help.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Ignore blank cells in Excel INDEX formula

    Glad to help & thanks for the feedback.

+ 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] Getting array/index formula to ignore blank cells
    By LandSim in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-14-2021, 04:14 PM
  2. Ignore blank cells when using Index and Match formula
    By Calaquendi in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-17-2021, 08:48 AM
  3. Replies: 3
    Last Post: 10-09-2019, 09:04 PM
  4. INDEX MATCH to ignore blank cells in array
    By Leaflock in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-05-2019, 06:36 PM
  5. [SOLVED] Ignore blank cells with formulas or ignore NA() in a formula
    By guiismiti in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 03-24-2016, 02:13 PM
  6. INDEX MATCH formula, ignore blank cells and define time frames
    By ChildishAlbino in forum Excel General
    Replies: 2
    Last Post: 02-16-2016, 03:16 PM
  7. Getting Excel to ignore Blank cells in a formula
    By SLOWBRAH in forum Excel General
    Replies: 2
    Last Post: 04-16-2014, 09:50 AM

Tags for this Thread

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