Forum Discussion

bellmatthias's avatar
bellmatthias
Copper Contributor
Nov 26, 2023

IF Statements with formulas

Hi,

 

I am trying to use an IF formula as a part of conditional formatting. The IF formula is "IF(K14=L14,TRUE,FALSE)". Every time I try to use the IF formula it says the logic is false. The two cells are equal to each other, and the only thing I can think of as an issue is that the cell K14 is using an arithmetic formula "=(I14-H14+J14)". Should I not be using the IF formula and if so, which formula should I use? And if I am supposed to use the IF formula, what error do I have that is causing this issue?

 

Thanks a lot!

  • djclements's avatar
    djclements
    Bronze Contributor

    bellmatthias Try using the ROUND function to round the results of your calculation to the appropriate number of decimal places. If you're dealing with whole numbers, for example, try any variation of the following:

     

    =ROUND(K14, 0)=L14

     

    - OR -

     

    =ROUND(K14, 0)=ROUND(L14, 0)

     

    - OR -

     

    =ROUND(K14-L14, 0)=0
  • mathetes's avatar
    mathetes
    Silver Contributor

    bellmatthias 

     

    I will offer the observation that conditional formatting often takes trial and error, especially during the early learning phases of using Excel. I've used Excel for decades, literally, and still find myself sometimes struggling to get the conditional formatting rule (especially using formulas) to work.

     

    This worked for me, using in K14 the same formula you have. Notice the conditional formatting formula is very simple. =(K14=L14)  But notice there are no quotes around it in the conditional formatting rule. Getting rid of those is its own step sometimes.

     

    It doesn't require the IF function,  because all you're asking is "does K14 = L14"? so Excel evaluates that formula and returns 1 (true) if they are equal, and 0 (false) if they're not.

     

    • bellmatthias's avatar
      bellmatthias
      Copper Contributor
      mathetes Thanks for responding. When I checked out your example, it worked perfectly fine, but when I tried to apply it to my sheet, it still calls it false. Is it possible excel is just glitching?
      • mathetes's avatar
        mathetes
        Silver Contributor

        bellmatthias 

         

        when I tried to apply it to my sheet, it still calls it false. Is it possible excel is just glitching?

         

        Not likely. VERY unlikely in fact. Especially on some aspect that's been around as long as conditional formatting, it would be next to impossible that you have discovered a glitch in this routine. So let's look for what's going wrong.

         

        Is it possible for you to post a copy of your spreadsheet on OneDrive or GoogleDrive, and paste a link here that grants access to it? So long as it doesn't have confidential info in it. If it does, maybe make a mockup that still illustrates the error.

Resources