Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

When using Index(Match, it returns zero if the referenced cell is blank. How can I prevent this?

Then using Index(Match, the formula returns a zero if the referenced cell is blank. Is there a way to prevent this from happening? I would rather it stay blank if the referenced cell is blank.

Thanks!

MacBook Pro (15-inch Mid 2012), OS X Yosemite (10.10.5)

Posted on Sep 1, 2015 7:42 PM

Reply
Question marked as Best reply

Posted on Sep 1, 2015 8:41 PM

you can use conditional formatting to make the text color the same as the background when the result is 0 (zero)

User uploaded file

you can create a custom format that

User uploaded file

5 replies

Sep 2, 2015 12:04 AM in response to 19Joey83

Hi Joey,


As an alternate, you can use an IF statement to test for data in the source cell, and if none is found, to insert a null string in the receiving cell.

If there is an actual value of zero in the referenced cell, the formula will return that value. If the referenced cell is empty, or contains a null string, the formula will return a null string.

User uploaded file

The base formula in column D uses OFFSET and MATCH.


D2: =OFFSET($A$1,MATCH(ROW()-1,$A,0)-1,1)


The formula in column E uses the same base formula twice. The first instance (bold) tests the LENgth of the result and compares that value with zero.If the LENgth is greater than zero, the formula is called again (italic), and the result returned to the cell containing the formula. If the LENgth of the result is zero, IF returns a null string ( "" ) to the formula's cell.


E2: =IF(LEN(OFFSET($A$1,MATCH(ROW()-1,$A,0)-1,1))>0,OFFSET($A$1,MATCH(ROW()-1,$A,0)-1,1),"")


Regards,

Barry

When using Index(Match, it returns zero if the referenced cell is blank. How can I prevent this?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.