0

I have the following excel sheet:

  Value
2 50
3 60
4 50
5 0
6 0
7 60

I am trying to count the number of times when comparing 2 rows a time the first or second is bigger by Value and Value is not 0.

For example:

I am currently using:

=IFS(A2>A3;"Original";A2<A3;"Fake";A2=A3;"Equal")

Which simply adds a text value to column B by checking 2 Values. What I'd like to add is a statement - & Value>0.

Expected output:

  Value   State
2 50      Fake
3 60
4 50      (empty because row 5 is 0)
5 0
6 0       (empty because row 6 is 0)
7 60

In short - how can I count the number of occurrences when condition #1 is met and condition #2 is met, when the second condition is not a text value but a number comparison?

Thank you for your suggestions.

2
  • 3
    Can you add what the expected output is for your table? Commented Feb 17, 2020 at 15:58
  • Hi @urdearboy, I've added the expected output. Commented Feb 18, 2020 at 8:51

1 Answer 1

2

Try following formula:

=IFERROR(CHOOSE((A2>A3)*(A3<>0)*1+(A2<A3)*(A2<>0)*2+(A2=A3)*(A2<>0)*3;"Original";"Fake";"Equal");"")

enter image description here

Edit

With condition that the formula works every second row.

=IFERROR(CHOOSE(((A2>A3)*(A3<>0)*1 + (A2<A3)*(A2<>0)*2+(A2=A3)*(A2<>0)*3)*(MOD(ROW();2)=0);"Original";"Fake";"Equal");"")
Sign up to request clarification or add additional context in comments.

3 Comments

Hi @basic, row 2 is good, row 3 is not, because it is comparing row 3 and row 4, whereas I only need to compare 2 by 2 rows, so only row 2,4,6,8... should have the formula.
Well, then you can copy formula every other row or add a condition that the formula return result in every second row. See edit.
Thank you, I was looking for a command to paste copied cells into every second row.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.