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

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

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
53,615
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,615
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
907
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,615
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,615
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,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...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top