Compare two columns (and ignore 0)

Mandy_

New Member
Joined
Jan 29, 2021
Messages
36
Office Version
  1. 365
Platform
  1. MacOS
Hi,

I'm trying to compare two columns with numerals.

Compare column A against B.
If column A = 0, then answer is from column B

Then for the remaining data I wish to compare column A next to B, and only if the values aren't equal to each other, then grab column A answer, otherwise column B answer.
(And if they aren't equal it doesn't matter I just need the value.)

I'm having trouble writing the formula and would appreciate some help please.

Thank you,
 

Attachments

  • Screen Shot 2023-09-07 at 10.45.37 pm.png
    Screen Shot 2023-09-07 at 10.45.37 pm.png
    16.5 KB · Views: 7

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
How about
Excel Formula:
=IF(A2=0,B2,A2)
 
Upvote 0
Solution
Thank you!

How does that formula know what to do when the cells are equal?
 
Upvote 0
How does that formula know what to do when the cells are equal?
As you said, it doesn't matter when they are equal, it can pull either one.
So I don't think you have any concerns there.
 
Upvote 0
If the cells are the same it doesn't matter which one it uses.
 
Upvote 0

Forum statistics

Threads
1,215,088
Messages
6,123,056
Members
449,091
Latest member
ikke

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