简体   繁体   中英

Excel Formula to Add Varying Amounts to Previous Cell

I'm hoping someone can help me with this formula: I need to create a list of numbers like the list below – basically I need 11 added to the previous cell, unless the previous cell ends in “6”, then only 4 gets added to the previous cell, and then adding 11 continues until the next cell ending in "6"

123456111
123456122
123456133
123456144
123456155
123456166
123456170
123456181
123456192
123456203
123456214
123456225
123456236
123456240
123456251
123456262
123456273
123456284
123456295
123456306
123456310
123456321

Thanks!

Put 123456111 in A1

Then, put

=IF(RIGHT(A1,1)="6",A1+4,A1+11)

in A2, then copy down

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM