Getting Excel to choose a value if it is there

NJS1982

Board Regular
Joined
Sep 24, 2009
Messages
183
Office Version
  1. 365
Platform
  1. Windows
Hi, I have a list of codes in column T and column U.
Some lines have codes in both cells, some in only U.
If a code does not appear in column T (all that is there is a VLookup formula), I need to use the code that is in column U.
The formula I am using is this (looking at row 161 in this instance):

=IF(T161<>0,T161,U161)

This seems to work with some lines, but others it is just returning a blank output. Any ideas why?

The codes are all being pulled through from elsewhere, via VLookup. In addition, they are codes with letters and numbers.

Thanks!
 
Last edited:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
@NJS1982, if your codes contain alphanumeric data, then you can't treat them as a number. When you use "T161<>0," the IF() function is literally checking whether or not the value zero exists in that cell.

Try this:

Code:
IF(T161<>"",T161,U161)
 
Last edited:
Upvote 0
Thanks for the reply @ErikTyler. So, is there a similar formula to try and work out if the cell is blank? I am struggling as I have a formula in cell T161, even though the outcome of the formula in T is blank.
 
Upvote 0
The formula I presented is checking whether T161 holds a value of null, not whether it is blank. So if the formula in T161 results in a null value, then that formula will move to the FALSE clause and show the value of U161.

If you have a formula in T161, why do you want to check whether it is blank? You already know it isn't (i.e., it contains a formula).

However, if for some reason you need to check whether the cell were blank (i.e., there is no value and no formula in it):

Code:
=IF(ISBLANK(T161),U161,T161)

Note the reversal of the middle and last arguments.
 
Upvote 0

Forum statistics

Threads
1,214,967
Messages
6,122,503
Members
449,090
Latest member
RandomExceller01

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