Evaluate a range and return rightmost result (nested if?!)

katel99

New Member
Joined
Nov 8, 2017
Messages
16
Hi there,

I currently use an IF formula to evaluate two cells, and return the data in the 1st cell if there is nothing in the 2nd, and the 2nd cell if it is populated;

=IF(B1="",(A1),(B1))

Now I would like to do this across an array of cells, i.e. I would like the rightmost cell in a range to be the returned result. i.e.

A1 B1 C1 D1 E1 F1
10 20 15 17 17


OR


A1 B1 C1 D1 E1 F1
10 20 15 15

Apologies, not sure how to paste a screenshot - but you get the gist!

Any ideas how to do this? Is there a specific formula, or should I use an nested IF (which i am struggling with!!)

Thanks in advance :)
 

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.
How about this...

Code:
=LOOKUP(9.999E+307,A1:F1,A1:F1)
 
Last edited:
Upvote 0
Amazing, thanks both this has worked a treat!

Next question - what is the formula doing so I can try to get my head around it (and apply it again in the future!)

Thanks :)
 
Upvote 0
The lookup value, 9.999E+307, is just a huge number. The idea is that it is a number bigger than anything you could conceivably have in your lookup range. Then the Lookup function cant find that huge number, so it returns that last value in the range. And in this case, your lookup range and your result range are the same.
 
Upvote 0
To try to put it simply no number in excel can be bigger than 9.999E+307. You often see it refered to as bignum. LOOKUP will continue to look for bignum until it exhausts its range of numbers. As we are sure it will never find it we know its just going to return the last number in the range.
 
Upvote 0

Forum statistics

Threads
1,215,148
Messages
6,123,300
Members
449,095
Latest member
Chestertim

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