Vlookup - display previous value if zero

MMarius

Board Regular
Joined
Sep 15, 2015
Messages
60
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).
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
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:
Upvote 0
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 :)
 
Upvote 0
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
 
Upvote 0
Try
=IF(MODIFY!A2 > 0,MODIFY!A2,A7)
 
Upvote 0
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:
Upvote 0
That formula is in E7 so you cannot have it checking itself.
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,220
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top