[英]IF statement to turn positive values into negative values in Excel
I have a dataset of lat/lon coordinates in Excel, but some of the coordinates were improperly entered.我在 Excel 中有一个纬度/经度坐标数据集,但某些坐标输入不正确。 What would be the Excel code to change a positive coordinate to a negative one (and leave negative values as they are)?
将正坐标更改为负坐标(并保持负值不变)的 Excel 代码是什么?
latitude longitude
25.66632 -80.26313
25.65948 80.26483
25.64070 -80.27083
25.63548 -80.27487
25.63320 80.27678
25.63137 -80.27763
If longitude data is in column C (from C2 onwards, say) - then you can deploy a couple of synonymous techniques - depending upon your preference:如果经度数据在 C 列中(例如,从 C2 开始) - 那么您可以部署一些同义技术 - 取决于您的偏好:
=if(C2>0,-C2,C2)
: perhaps most intuitive =if(C2>0,-C2,C2)
:也许是最直观的=-abs(C2)
: parsimonious, kudos to Jadefalke (26/01/22 - commentary) =-abs(C2)
: 简约,对 Jadefalke 表示敬意 (26/01/22 - 评论) Array functions exist for these too - ie for a column of data C2:C10, you can enter (once) in the corresponding leading (top) cell =-abs(C2:C10).这些也存在数组函数——即对于一列数据 C2:C10,您可以在相应的前导(顶部)单元格 =-abs(C2:C10) 中输入(一次)。 see here for details RE: Office 365 compatible vs. prior versions of Excel.
有关详细信息,请参阅此处RE:Office 365 兼容与 Excel 的先前版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.