Formula with if and odd rows

jevi

Active Member
Joined
Apr 13, 2010
Messages
339
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

I am trying to make a formula but no result. The if that i need IF is like in the fourth column.

The first row is OK because the cell B2 is empty and C2 has the same value as C1. So the secondo row is considered also OK.
The third row is Ok because B4 is empty and C4 has the same value as C3. So the row 4 is considered also OK.
The fifth row is Alert because B6 is not empty and C6 is different from C5.
The sixth row is Alert because is the last row where there is no more data after it or let say because C7 is different from C6.

Any help with this formula? The logic is that after each code in column B it should be a row with empty code but the the same sum in column C as the one above, that is OK otherwise Alert.

1667835628425.png


Thank you,
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Could probably be shorter, but gets the job done.

Book1
ABCD
1CodeSumIF
21004569100OK
329100OK
4300578200OK
548200OK
6500588300alert
76006018400alert
87
Sheet4
Cell Formulas
RangeFormula
D2:D7D2=IF(ISODD(A2),IF(AND(B3="",C2=C3),"OK","alert"),IF(AND(B2="",C2=C1),"OK","alert"))
 
Upvote 0
You don't need to check if the row is odd. Use the following formula:
Excel Formula:
=IF(OR(AND(B2="", NOT(B3=""), C2=C1), AND(NOT(B2=""), B3="", C2=C3), "OK", "ALERT")
The logic breaks down as follows

If either of the following are true (these are the two success cases)
--This B value is blank, the next B value is not blank, and this C value is equal to the previous C value
--This B value is not blank, the next B value is blank, and this C value is equal to the next C value
then the data line is OK. Otherwise, return an Alert

Omitting the odd row checking makes this formula portable to any location on any sheet as long as your table is formatted the same way
 
Upvote 0
Solution
@ Automatrix, It didn't work n my file but maybe we don't need to go with ODD, my fault as thinking that after the code the odd should be empty. Still thank you for your formula.

@ Mortiray it worked great and true no need for ODD but I did the confusion. Most of all thank you for the explanation as I did understand better the formula.

thank you a lot
 
Upvote 0

Forum statistics

Threads
1,224,836
Messages
6,181,248
Members
453,026
Latest member
cknader

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