[英]Need help in generating a formula for nextID excel column
I have a an excel sheet with the following columns ID, City, Record no. 我有一个具有以下列ID,城市,记录号的Excel工作表。 I need to generate a column called Next ID based on the record number. 我需要根据记录号生成一个名为“下一个ID”的列。 ie if the city is same I need to populate the Next ID column with the ID of the previous record number. 也就是说,如果城市相同,则需要使用上一个记录编号的ID填充“下一个ID”列。
Is there a way to do this in excel? 有没有办法在excel中做到这一点?
Here is the sample data, with the Next Column populated manually for reference: 以下是示例数据,并手动填充了“下一列”以供参考:
ID City Record no. **Next ID
121 Paris 3
122 Paris 2 121
123 Paris 1 122
124 New York 2
125 New York 1 124
Please see attached image 请看附件图片
I've edit the question as I was not able to add a image in the comments. 我无法编辑图片,因此无法编辑图片。 My data is not sorted so I used the second formula. 我的数据未排序,因此我使用了第二个公式。 This works for some cases but doesn't work for others. 这在某些情况下有效,但在其他情况下则无效。 see the pink colored cells which should have a value but do not. 看到粉红色的单元格应该有一个值,但没有。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.