IF AND OR Statement

Mike7792

New Member
Joined
Aug 7, 2018
Messages
2
Hello,

I'm sure it's relatively simple but I'm trying to do a formula whereby I can return the Ref no. in column C if there is cost in column A but no volume in Column B or vice versa. I want to try and do it all in one formula but when i try and add in the OR part of the statement, excel wants me to multiply by OR which makes it error. Basically if there are any instances where there are cost with no volume or volume with no cost, I'd like to return the reference in column C

[TABLE="width: 500"]
<tbody>[TR]
[TD]Cost[/TD]
[TD]Volume[/TD]
[TD]Ref[/TD]
[/TR]
[TR]
[TD]£200[/TD]
[TD]2[/TD]
[TD]AL001[/TD]
[/TR]
[TR]
[TD]£100[/TD]
[TD]4[/TD]
[TD]AL002[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]5[/TD]
[TD]AL003[/TD]
[/TR]
[TR]
[TD]£400[/TD]
[TD]6[/TD]
[TD]AL004[/TD]
[/TR]
[TR]
[TD]£180[/TD]
[TD][/TD]
[TD]AL005[/TD]
[/TR]
</tbody>[/TABLE]

Any help would be appreciated.

Thanks
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi Mike,

If your Cost is in column A (formatted as "Currency") and Volume is in column B (formatted as "Number") then maybe try to do the following:
=IF(AND(A1*B1=0,SUM(A1:B1)<>0),"display ref number","do not display ref number")

Not sure how you want to display the Reference number - is it a lookup to another column?

Let me know if that works for you.

Best regards,
Justyna
 
Upvote 0
Hi Justyna,

Yes this works perfectly, thank you for taking the time to reply.

Have a great day

Mike
 
Upvote 0
Cool, glad to hear it works!

Take care,
Justyna
 
Upvote 0
Hi,

If Columns A and B are Numbers, use D2 formula copied down.
If Columns A or B might be Text, then use E2 formula copied down.


Book1
ABCDE
1CostVolumeRef
2$2002AL001  
3$1004AL002
45AL003AL003AL003
5$4006AL004
6$180AL005AL005AL005
Sheet165
Cell Formulas
RangeFormula
D2=IF(COUNT(A2:B2)=2,"",C2)
E2=IF(COUNTA(A2:B2)=2,"",C2)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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