Increase a cell’s value based on other cell’s value

Posted on

QUESTION :

What I am looking for is an “IF” formula that can solve my problem:

  1. I have a single sheet with 2 columns and an unlimited number of rows.

  2. On the first column (Column#1), I have a drop-down with only two values: “Option1” and “Option2”; “Option1” is linked to “x” and “Option2” is linked to “y”

  3. On the second column (Column#2), I have to give consecutive numbers to each value.

I used this formula on Column#2 ~ =IF(A14=”Option1″,”x”,IF(A14=”Option2″,”y”,””)) ~ to offer the ID for each option.

I don’t know how to count the values that will have to appear after each value from Column#2.

e.g. – this is how it should look:

Column#1…………Column#2

  1. Option1…….x1
  2. Option1……..x2
  3. Option2…….y3
  4. Option1……..x4
  5. Option2…….y5

How can I do this?

ANSWER :

With data in column A, in B1 enterr:

=IF(RIGHT(A1,1)="1","X","Y") & ROW()

and copy down:

enter image description here

EDIT#1:

and to leave the formula cell blank of the column A cell is blank, use:

=IF(A1="","",IF(RIGHT(A1,1)="1","X","Y") & ROW())

EDIT#2:

To start anywhere, say B5, use

=IF(A5="","",IF(RIGHT(A5,1)="1","X","Y") & ROWS($1:1))

Leave a Reply

Your email address will not be published. Required fields are marked *