# Bit of a Tricky One

#### boojooo

##### New Member
Hello,

I have a bit of a tricky one, maybe. I have formulas in both cells A1 and B1 that will either return a value or be left blank. What I would like to do is create another formula in cell D1 that returns the value of cell C1, but only if either cells A1 or B1 have values in them (not blank). I think I'm close with this formula in cell D1: IF(or(A1>0,B1>0),(C1,"")

### Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

#### DanteAmor

##### Well-known Member
Try

=IF(OR(A1>0,B1>0),C1,"")

#### Joe4

You are close. It is:
Code:
``[COLOR=#333333]=IF(OR(A1>0,B1>0),C1,"")[/COLOR]``
(you just had an extra parenthesis)

Last edited:

#### boojooo

##### New Member
There are formulas in A1 and B1 however, that either return a value or remain blank. The formula you gave me works, but even if both the formulas in A1/B1 cells are returning a blank cell D1 is still populating the value in C1. If I delete the formulas out of A1/B1 then D1 becomes empty.

#### Joe4

Are you formulas in A1 and B1 REALLY returning nothing, or are they returning a single space (" ")?
Can you post the formulas in those cells?

Maybe try:
Code:
``[COLOR=#333333]IF(OR(LEN(TRIM(A1))>0,[/COLOR]LEN(TRIM(B1))>0),C1,"")``
which will ignore blank spaces.

#### hrayani

##### Well-known Member
Can u provide what formulas do you have in A1 & B1

A1

B1

#### Joe4

Did you try the updated formula I provided?
Did that work?

#### boojooo

##### New Member
That worked, thank you! Sorry about the delay, too many formulas in my spreadsheet cause it to error out for a bit before coming back up.

#### Joe4

You are welcome.

Do you ever have instances in which your VLOOKUP does not find what it is looking for and returns an error?
If so, you should wrap the VLOOKUP in an IFERROR statement, i.e.
Code:
``[COLOR=#333333]=IF(OR(Input!F103="large-22",Input!F103="large-25.4"),[/COLOR][COLOR=#ff0000]IFERROR[/COLOR][COLOR=#333333](VLOOKUP(B103,'B:\Menu Database\[BeerDatabase1.xlsx]Sheet1'!\$A\$3:\$AN\$40000,40,FALSE),[/COLOR][COLOR=#ff0000]""[/COLOR][COLOR=#333333]),"")[/COLOR]``
which return a blank in the event of not finding a match.

1,101,847
Messages
5,483,279
Members
407,390
Latest member
jenniferjohns

### This Week's Hot Topics

• Finding issue in If elseif else with For each Loop
Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
• MsgBox Error
Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
• CELL FORMAT - IF CONDITION
My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
• Show numbers nearly the same
Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...