Forum Discussion
Auto populate data based on unique values
- Apr 07, 2020
In the following formula, I do make the assumption that you enter the starting value in cell B1. This formula then works when you copy it all the way down as the attached spreadsheet shows.
=IFS(AND(A2<>A1,B1=5),1,A2<>A1,B1+1,A2=A1,B1)
(I haven't tried it, but it stands to reason that you could switch around the sequence of those conditions and their consequences, for example, first checking whether A2=A1 and then leaving the value in column B the same. This just happens to be the way I wrote it.)
In the following formula, I do make the assumption that you enter the starting value in cell B1. This formula then works when you copy it all the way down as the attached spreadsheet shows.
=IFS(AND(A2<>A1,B1=5),1,A2<>A1,B1+1,A2=A1,B1)
(I haven't tried it, but it stands to reason that you could switch around the sequence of those conditions and their consequences, for example, first checking whether A2=A1 and then leaving the value in column B the same. This just happens to be the way I wrote it.)
- Mak_LudwigApr 07, 2020Copper Contributor
- mathetesApr 07, 2020Gold Contributor
You're very welcome.
As it happens, this is (if memory serves me) the first time I've ever employed the IFS function. I started off trying to nest IF within IF, and was getting confused as I went; said to myself, maybe that IFS function--I'd read about it and seen it in other postings here--would serve well. And not only did it work well; it was also easy to use.
So thank you for that learning opportunity. I'll be using it more myself.