Bit of a Tricky One

boojooo

New Member
Joined
Nov 15, 2012
Messages
33
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,"")
 

Some videos you may like

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
53,410
Office Version
365
Platform
Windows
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
Joined
Nov 15, 2012
Messages
33
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

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
53,410
Office Version
365
Platform
Windows
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
Joined
Jul 23, 2010
Messages
892
Office Version
2016
Platform
Windows
Can u provide what formulas do you have in A1 & B1
 

boojooo

New Member
Joined
Nov 15, 2012
Messages
33
A1
=IF(OR(Input!F103="large-22",Input!F103="large-25.4"),(VLOOKUP(B103,'B:\Menu Database\[BeerDatabase1.xlsx]Sheet1'!$A$3:$AN$40000,40,FALSE)),"")

B1
=IF(OR(Input!F103="small-12",Input!F103="small-16.9"),(VLOOKUP(TOAST!B103,'B:\Menu Database\[BeerDatabase1.xlsx]Sheet1'!$A$3:$AO$40000,41,FALSE)),"")
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
53,410
Office Version
365
Platform
Windows
Did you try the updated formula I provided?
Did that work?
 

boojooo

New Member
Joined
Nov 15, 2012
Messages
33
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

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
53,410
Office Version
365
Platform
Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,099,017
Messages
5,466,054
Members
406,462
Latest member
I10V3xl

This Week's Hot Topics

Top