Conditional Formula in Excel

Microsoft Excel 2007
September 1, 2010 at 17:13:16
Specs: Windows 7
I'm trying to write a conditional formula for a spreadsheet. I want to have the conditions apply only when one cell (A849) equals the previous cell (A848). As it stands right now, I have the conditions ready to go, but can't quite figure out how to trigger the initial condition stated above.

Here are the conditions that I want to apply if, and only if, cell A849 = A848
=IF(F849>G848," ",IF(F849=G848," ",IF(F849<G848,"ERROR")))

Anyone have an idea? I appreciate it.

See More: Conditional Formula in Excel

Report •

September 1, 2010 at 17:43:53
From what I understand you want the formula:

=IF(F849>G848," ",IF(F849=G848," ",IF(F849<G848,"ERROR")))

to execute only if A849=A848, then try this:

=IF(A849=A848,IF(F849>G848," ",IF(F849=G848," ",IF(F849<G848,"ERROR"))),"")

Or am I missing something?


Report •

September 1, 2010 at 17:50:53
Well, there's a bunch of stuff going on here.

I'll answer your question first, then mention a few other things:

To only have your conditions apply when A848=A849 all you need to do is wrap another IF around your conditions, with your conditions being the value_if_true for the first condition:

=IF(A848=A849,IF(F849>G848," ",IF(F849=G848," ",IF(F849<G848,"ERROR"))),"")

That said, I'd like to point out a couple of things:

1 - You'll note that I used "" (2 double quotes right next to each other) as the value_if_false for the first condition (IF(A848=A849). "" is diferent than " " (2 double quotes with a space in between) which is what you used.

"" will put nothing in the cell while " " will put a space in the cell. While they make look the same i.e. a "blank cell" they are not the same.

2 - Let's look at your original formula:

=IF(F849>G848," ",IF(F849=G848," ",IF(F849<G848,"ERROR")))

That could be condensed to the following which will return "ERROR" if F849<G848 and return a space for the only other 2 conditions that could exist. In other words there is no need to check for the > or = conditions.

=IF(F849<G848, "ERROR", " ")

The following will give you a blank cell, not a cell with a space in it:

=IF(F849<G848, "ERROR", "")

Putting that all together, I believe this is the formula you are looking for:

=IF(A848=A849, IF(F849<G848, "ERROR", ""), "")

Report •

September 2, 2010 at 09:42:29
Thanks, guys!

A combination of Mike's response and DerbyDad03 worked perfectly!

Report •
Related Solutions

Ask Question