ExcelTip.com
ExcelTip.com
Account Icon Account Icon Account Icon
Google Exceltip.com
JOIN OUR NEWSLETTER
  and receive for joining:
Free eBook Learn More!
Free Excel ADD-IN
Free Weekly Excel Tip
4 e-books in cd-rom
F1 Formulas & Functions
F1 Formulas & Functions
F1 EXCEL
F1 eBook (Spanish)
F1 EXCEL
Financial Statements.xls
 

» Retrieving the Value of the First Non-Blank Cell in a List
CATEGORY: Lookup Formulas
Problem:

Retrieving the value of the first non-blank cell in Range1 (cells A2:A7).

Solution:
Use the INDEX and MATCH functions as shown in the following Array formula:
{=INDEX(A2:A7,MATCH(TRUE,A2:A7<>"",0))}

To apply Array formula:
Select the cell, press and simultaneously press .


Rate this tip
12 34 5
  RATING: 2.33
  VIEWS: 12038

READER COMMENTS (view all comments)


Would not work for me
leveyc wrote on February 02, 2007 22:34 EST
Hi I was looking at this formula but I keep getting a Value error, what I really was looking for was a formula that would retrieve data from a adjacent cell if data was entered in to a specified cell i.e. If A1:A5 and B1:B5 had text in them and data was enter in C1 I could return the data in A or B1 in a cell of another sheet

oldchippy wrote on February 03, 2007 07:07 EST
The formula in the Excel Tip is incomplete, it should be

=INDEX(A2:A7,MATCH(TRUE,A2:A7<>"",0))

To apply Array formula, so the the braces appear in the formula bar { } like so

Select the cell, press Ctrl+Shift+Enter

For the second part of your question take a look at this link, as a lookup looks like the solution to your problem

[url]http://support.microsoft.com/kb/214252[/url]
Would not work for me
leveyc wrote on December 31, 1969 19:00 EST
Hi, I tried this formula but everytime I use it I always get #VALUE! why? and if I wanted to find the second non blank and so on how would i mod the formula

leveyc wrote on February 05, 2007 12:00 EST
Thanks for the info very handy, but its not quite there, the piece missing is....I need the formula in A1 to look in a separate sheet in column C for the first cell in with data in it and report back all adjacent cell information, then in the next cell A2I need it to find the second cell in column C with data and report back adjacent call info....all help greatly appreciated Thanks

oldchippy wrote on February 07, 2007 07:56 EST
Hi leveyc,

Sorry for the delay in coming back to you, but I've been trying to come up with a solution to your problem. I've found a formula on Chip Pearson's site that reforms a column to eliminate blanks, the problem I'm having with the formula is writing it on Sheet1 to look at column C on Sheet2 once we've achieved that it a case of then doing a Vlookup for the other information. I'll keep you posted.

Here's the link in question

[url]http://www.cpearson.com/excel/noblanks.htm[/url]

Bryan Hessey wrote on February 07, 2007 08:40 EST
[QUOTE=oldchippy]The formula in the Excel Tip is incomplete, it should be

=INDEX(A2:A7,MATCH(TRUE,A2:A7<>"",0))

To apply Array formula, so the the braces appear in the formula bar { } like so

Select the cell, press Ctrl+Shift+Enter

For the second part of your question take a look at this link, as a lookup looks like the solution to your problem

[url]http://support.microsoft.com/kb/214252[/url][/QUOTE]Hi,

To get column C from the first non-blank row of Sheet2,

try

=OFFSET(Sheet2!A1,MATCH(TRUE,Sheet2!A1:A50<>"",0)-1,2)

CSE (CTRL/Shift/Enter)

to get the following row column B use

=OFFSET(Sheet2!A1,MATCH(TRUE,Sheet2!A1:A50<>"",0)-0,2)

and the next row

=OFFSET(Sheet2!A1,MATCH(TRUE,Sheet2!A1:A50<>"",0)+1,2)

however, looking up the 'next non-blank' if further blanks appear in the range could be difficult.

hth
---

oldchippy wrote on February 07, 2007 08:49 EST
Hi Bryan,

How about using the formula from Chip's web page to create a list of non-blanks on Sheet1 from column C (with the blanks in) on Sheet2 , then using a vlookup table to get the additional data from the other columns on sheet2

oldchippy wrote on February 07, 2007 10:20 EST
[QUOTE=leveyc]Thanks for the info very handy, but its not quite there, the piece missing is....I need the formula in A1 to look in a separate sheet in column C for the first cell in with data in it and report back all adjacent cell information, then in the next cell A2I need it to find the second cell in column C with data and report back adjacent call info....all help greatly appreciated Thanks[/QUOTE]
Hi leveyc,

This is the only way I can see how to get the data from the non-blank cells from a separate sheet. Hope this helps - let me know?
I think its nearly there
leveyc wrote on February 07, 2007 21:42 EST
Oldchippy

Thank you, I think its nearly there, I guess the only way to get it complete is to send you the worksheet so you can see what I'm trying to work on, I have attached part copy with some notes, do appreciate your help

Thanks

leveyc

oldchippy wrote on February 08, 2007 04:20 EST
Can not open your zip file, are you using Excel 2007, if so save it as 2003, then I will be able to open it. If you are not using 2007, try zipping it again.
Try this one
leveyc wrote on February 08, 2007 16:41 EST
OldChippy

Thanks

oldchippy wrote on February 09, 2007 04:32 EST
Hi leveyc,

Try this one, I think this will work for you?
Thank You
leveyc wrote on February 09, 2007 10:54 EST
Hey OldChippy


It works like a dream, thanks very much

oldchippy wrote on February 09, 2007 16:05 EST
Glad to help - thanks for the feedback



REGISTERED USERS - Click here to post comments


GUESTS (Click here to register)
Name
Comment Title
Comments

The 11 Immutable Laws of Internet Branding

Learn MS Excel 2002 VBA/XML Programming

Business Plans For Dummies®

The Financial Numbers Game: Detecting Creative Accounting Practices

Harry Potter and the Order of the Phoenix (Book 5)

Financial Reporting and Analysis (2nd Edition)

RELATED MICROSOFT EXCEL TIPS


Convert PDF Files to Excel






Excel VBA books
Accounting books
Business Plans
MS Office books
Taxes books

VIEW ALL BOOKS


  Advertise With Us                               

Tips

Add-In in VBA | Applications - Word, Outlook in VBA | Array Formulas | Cells, Ranges, Rows, and Columns in VBA | Counting | Custom Functions | Custom Functions in VBA | Database Formulas | Database in VBA | Date & Time Formulas | Date & Time in VBA | Events in VBA | Excel 2003 | Excel Chart | Excel Consolidating | Excel Counting | Excel Custom Functions using VBA | Excel Customizing | Excel Data | Excel Dates | Excel Editing | Excel Files | Excel Filter | Excel Format | Excel Formula | Excel General | Excel Grouping and Outlining | Excel Importing Text Files | Excel Information | Excel Keyboard Shortcuts | Excel Loan Formulas | Excel Macros - VBA | Excel Pivot Tables | Excel Printing | Excel Range Name | Excel Security - Protection | Excel Sorting | Excel Style | Excel Subtotals | Excel Summing | Excel Text | Excel Time | Excel Tools | Excel Worksheet, Workbook | Files, Workbook, and Worksheets in VBA | Financial Formulas | Formating in VBA | General Topics in VBA | Import and Export in VBA | Information Formulas | Keyboard & Other Shortcuts in VBA | Keyboard Formula Shortcuts | Links between Worksheet and Workbooks | Links in VBA | Logical Formulas | Lookup Formulas | Mail - Send and Receive in VBA | Menus, Toolbars, Status bar in VBA | Modules, Class Modules in VBA | Other Q&A Formulas | Printing in VBA | Protecting in VBA | Summing | Text Formulas | User Forms, Input boxes in VBA | Using Loops | Working with Formulas |

Tips by Version

Microsoft Excel 97 | Microsoft Excel 2000 | Microsoft Excel 2002 | All Microsoft Excel Versions | New in Excel 2002 | New in Excel 2003 - Office 11

Website

Home | Tip of Hour | Recommended Tips | Most Viewed Tips | Tips by Version | Submit a Tip | My Tips
Microsoft Excel Tutorials | Excel Links | Write for Us | About Us | Search Results | Tip Archives | Excel Forum | Excel Forum Archives

Excel Book

Excel 97 Book | Excel 2000 Book | Excel 2002 Book | Excel XP Book | Book Store

Terms and Conditions of use
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Copyright © 2003 ExcelTip.com
Microsoft, Microsoft Excel is a U.S. registered trademark of Microsoft Corporation
Site Developed By: Varien