Vlookup - display previous value if zero

MMarius

New Member
Joined
Sep 15, 2015
Messages
47
Hello,

I have an external connection pointing to an xml which display some values.


Sheet1: Values
Sheet2: External values

I managed to do it with Vlookup but since the XML sometimes doesn't updates correctly and points to "zero" (since it can't read it from external source) I will want to retain the value that was before zero.

E.g.: Let's say in Sheet2 (external xml), in A1 last value was 250150, but after "refresh all", it gave 0 since it can't read, on sheet1 it will display 0, i want it to display 250150 (retain the last value that is different from zero).
 

DSCfromCFA

Board Regular
Joined
Feb 27, 2018
Messages
122
G'day MM,

Try in Sheet 1 cell A1, and any others as required.:
=IF(Sheet2!A1 > 0,Sheet2!A1,A1) - don't include the spaces around the greater than sign as that is a format issue with these posts.

Cheers

shane
 
Last edited:

MMarius

New Member
Joined
Sep 15, 2015
Messages
47
G'day MM,

Try in Sheet 1 cell A1, and any others as required.:
=IF(Sheet2!A1 > 0,Sheet2!A1,A1) - don't include the spaces around the greater than sign as that is a format issue with these posts.

Cheers

shane
Hello,

Indeed, on a new created excel file, it works. But mine (based on TABLE), it doesn't work as intended. For Table do i need to apply different formula?

Thank you :)
 

DSCfromCFA

Board Regular
Joined
Feb 27, 2018
Messages
122
G'day MM,

I put the formula into a simple table and it works just the same. In what way is it not working as intended for you?

shane
 

MMarius

New Member
Joined
Sep 15, 2015
Messages
47
G'day MM,

I put the formula into a simple table and it works just the same. In what way is it not working as intended for you?

shane

I attached you the demo, in sheet "TEST1", E7 starts and retrieve data from sheet "MODIFY" but doesn't work as intended.

Thank you

DOWNLOAD FILE
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,332
Office Version
365
Platform
Windows
Try
=IF(MODIFY!A2 > 0,MODIFY!A2,A7)
 

MMarius

New Member
Joined
Sep 15, 2015
Messages
47
Try
=IF(MODIFY!A2 > 0,MODIFY!A2,A7)
UPDATE: managed to solve it :) Thank you :) Can be closed


Hi Fluff,

apprently works now, how do i use the above code with "if blank"?

I have values in D1 & E1 and i want if there are both blanks, to not display the formula.

D1 = empty
E1 = empty
H1 = value from formula not to be displayed =IF(MODIFY!A2 > 0,MODIFY!A2,A7)

If:

D1 = value
or E1 = Value
H1 = value to be displayed based on formula
 
Last edited:

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,332
Office Version
365
Platform
Windows
That formula is in E7 so you cannot have it checking itself.
 

Forum statistics

Threads
1,082,371
Messages
5,365,062
Members
400,820
Latest member
Gossow

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top