IF formula not correctly displaying

Copper Contributor

I am currently attempting to troubleshoot an IF formula statement. I am trying to filter out different numbers from 2 separate columns. I would like to keep all values between 1000 and 10000, with a special property given to numbers in cell P that are higher than the value in cell O while still under the range of >10000. My current If statement is: =IF(AND(P2>1000,P2>O2,P2<10000),P2,O2). I have tested this on an older version of Excel for Mac, and on Google Sheets and both work properly. Only when I am on Excel for windows does it not work (Version 2206. I have gone through each of the logicals separately and have concluded that O2<10000 is the only one that displays incorrectly.

O2: 4000    P2: 4500 (Needs to display column P) [Displays O2]

O2: 4000    P2: 0        (Needs to display O) [Displays O2]

O2: 4000    P2: 20000 (Needs to display O) [Displays O2]

O2: 4000    P2: 400 (Needs to display O) [Displays O2]

EDIT: Formula has been corrected. Still wrong, but more akin to my actual setup


6 Replies
best response confirmed by ChristianMaurer (Copper Contributor)

My first thought was to check that the 4500 in B2:4500 is entered as a number and not text. This happens to me sometimes when I copy numbers from another source. Should be no leading apostrophe ('), no spaces, etc. Also, highlight all the cells and explicitly define them as a number.

I thought it was that at first because of the way I was pulling the information, but I tested it separately.
The issue I sometimes experience is if I enter data into a cell that was not in the original range selection. I'm now in the habit of making sure I insert a row between the top and bottom cells, since the software is designed to assume that I want it in the total.
Another issue might involve cells that are merged, since it will assume you want the data from the left-most cell, which might be empty.
Formula logic is where I waste most of my time. I suggest working on some other project for an hour and then coming back to it when your brain has been reconfigured.
I was able to reconfigure the formula in a new sheet. It must have something to do with the values not being displayed correctly. I should be able to figure it out given some time. Just need to display the formula values as normal values. Thank you.