Put 1 as value of the next column for every first time a value appears on the adjacent column

Zedrick13

Board Regular
Joined
Sep 8, 2018
Messages
100
Please help me with coming up with a formula so that the value "1" appears on the corresponding row of a column for every first instance a code appears on another column. Like this:

Code:
         A        B
1    GL23      1
2    GL45      1
3    GL45        
4    GL50      1
5    GL23        
6    GL23        
7    GL45       
8    GL51      1

So, like in the example above, I want the value "1" appear on the next column (Column B) whenever a code appears for the first time in Column A.

Thanks in advance!
 

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.
231
451
45
501
23
23formula in B1
45
511=IF(COUNTIF($A$1:A1,A1)=1,1,"")

<colgroup><col width="64" span="9" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,935
Members
449,195
Latest member
Stevenciu

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