![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 6
|
Hi all,
I have a row with numbers that are the result of a VLOOKUP function, and I want cells to be blank (empty) when the source of the lookup is blank. The cells must be blank, not 0, because the results are plotted in a chart where blank values are interpolated. The current formula is: =IF(ISBLANK(E2),"",VLOOKUP(E2,R2:S12,2,FALSE)) This results in "" being interpreted as 0 in the chart Thanks! [ This Message was edited by: MJ on 2002-02-25 20:39 ] [ This Message was edited by: MJ on 2002-02-25 20:40 ] |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Posts: 202
|
you could try =IF(ISBLANK(E2),0,VLOOKUP(E2,R2:S12,2,FALSE)) and use custom format 0;-0;
[ This Message was edited by: anno on 2002-02-25 20:53 ] |
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Posts: 6
|
Nope, no dice. The chart doesn't heed the formatting of the cells, it still sees a 0.
Thanks though! [ This Message was edited by: MJ on 2002-02-25 20:58 ] |
|
|
|
|
|
#4 |
|
New Member
Join Date: Feb 2002
Posts: 6
|
I solved this with a VB macro that copies over the values from one column to another one if the value in the cell is greater than 0, and clears the cell otherwise. The chart now uses the new, filtered column.
Any tips on performance improvements (only trigger the code if a cell in the original column E changes, or if a cell in column T is recalculated, for example..)? Here's the code:
[ This Message was edited by: MJ on 2002-02-25 22:27 ] |
|
|
|
|
|
#5 |
|
New Member
Join Date: Feb 2002
Posts: 6
|
Solved it myself (learning more Excel than I wanted to..
Code: Private Sub Worksheet_Change(ByVal Target As Range) |
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,314
|
It's:
=IF(LEN(E2),IF(COUNTIF(R2:R12,E2),VLOOKUP(E2,R2:S12,2,0),""),"") Aladin Quote:
|
|
|
|
|
|
|
#7 |
|
New Member
Join Date: Feb 2002
Posts: 6
|
The problem is that as soon as you put a formula in a cell, it is no longer blank. It doesn't matter if the result is an empty string, charts will still interpret that as 0. My solution solves this by not having a formula take care of the cells sourced by the chart, but a VBA event handler, which explicetly can blank cells.
|
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
=IF(ISBLANK(E2),#N/A,VLOOKUP(E2,R2:S12,2,FALSE))
|
|
|
|
|
|
#9 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,314
|
Quote:
=VLOOKUP(E2,R2:S12,2,FALSE) suffice? |
|
|
|
|
|
|
#10 | ||
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
|
||
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|