简体   繁体   English

在Excel单元格中提取括号中的纬度和经度值

[英]extract latitude and longitude values in parenthesis in an excel cell

I have excel columns like this "5680 Konkel St Detroit 48210 (42.3270550004, -83.1107549997)" I just want to extract the lat longs. 我有这样的excel栏,例如“ 5680 Konkel St Detroit 48210(42.3270550004,-83.1107549997)”,我只想提取经纬度。 normally I would do a =right(a2,30) but the lat longs are different lengths so it doesnt work 通常我会做一个= right(a2,30)但拉特长是不同的长度,所以它不起作用

For lats (the first number in the comma delimited numbers.) 对于经纬度(逗号分隔的数字中的第一个数字。)

=--REPLACE(REPLACE(A1, FIND(",", A1), LEN(A1), TEXT(,)), 1, FIND("(", A1), TEXT(,))

For longs (the last number in the comma delimited numbers.) 长期(逗号分隔数字中的最后一个数字。)

=--REPLACE(LEFT(A1, LEN(A1)-1),1,FIND(",",A1)+1,TEXT(,))

Custom Number Formatted as 0.0########## . 自定义编号,格式为0.0########## In the image below note the right-aligned true numbers. 在下图中,请注意右对齐的真数字。

在此处输入图片说明

One longer formula: 一个较长的公式:

=--TRIM(MID(SUBSTITUTE(SUBSTITUTE(MID($A$1,FIND("(",$A$1)+1,LEN($A$1)),")",""),",",REPT(" ",999)),(COLUMN(A:A)-1)*999+1,999))

Put this in B1 and copy over to C1. 将其放在B1中,然后复制到C1中。

Then format as desired. 然后根据需要格式化。

在此处输入图片说明

If I understand you well, each cell in column A contains a text such as: "5680 Konkel St Detroit 48210 (42.3270550004, -83.1107549997)" and you want to extract the two numbers in parentheses. 如果您对我的理解很好,则A列中的每个单元格都包含一个文本,例如:“ 5680 Konkel St Detroit 48210(42.3270550004,-83.1107549997)”,并且您想提取括号中的两个数字。

I would advice you to NOT use the formulas suggested by the others, as their formulas are convoluted and hard to maintain. 我建议您不要使用其他人建议的公式,因为它们的公式很复杂并且难以维护。 If you want to understand what you are doing, please do it in steps by utilizing extra columns (which you can hide afterwards if you want) as follows.: 如果您想了解自己在做什么,请按以下步骤逐步使用多余的列(如果需要,可以将其隐藏)。

On column B, in cell B1 enter the formula =FIND( "(", A1 ). 在B列的B1单元格中,输入公式= FIND(“(”,A1)。

This will return an integer, which is the position of the character "(" in your original text in cell A1. 这将返回一个整数,它是字符“(”在单元格A1中原始文本中的位置。

Then on column C, in cell C1 enter =FIND( ",", B1 ), where we use the previous value returned in B1 as the start index, since we know "," is located after "(" 然后在C列的C1单元格中输入= FIND(“,”,B1),在此我们将B1中返回的先前值用作起始索引,因为我们知道“,”位于“(”之后

On column D, in cell D1 enter =MID( A1, B1+1, C1-B1), which will give you the first number. 在D列的D1单元格中,输入= MID(A1,B1 + 1,C1-B1),这将为您提供第一个数字。

Then on column E, in cell E1 enter =FIND( ")", C1 ), where we use C1 as the start index since we know ")" is located after "," 然后在E列的E1单元格中,输入= FIND(“)”,C1),在此我们将C1用作起始索引,因为我们知道“)”位于“,”之后

Finally on column F, in cell F1 enter =MID( A1, C1+2, E1-C1-1), which will give you the second number. 最后,在F列的F1单元格中输入= MID(A1,C1 + 2,E1-C1-1),这将为您提供第二个数字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 Excel 中的一个单元格文本字符串中提取一或两个单元格的经度和纬度 - Extract longitude and latitude to either one or two cells, from one cell text string in Excel 在excel中从纬度和经度计算航向 - calculating heading from latitude and longitude in excel Excel-从具有每个单元格中多个值的列中提取唯一值 - Excel - extract unique values from a column with several values in each cell 如何匹配多个列值并在Excel中提取相应的单元格值 - How match multiple column values and extract corresponding cell values in Excel Excel 文本连接:从重复的列值中提取单元格值 - Excel Text Join: Extract Cell Values From Duplicated Column Values 在 Excel 中使用纬度和经度计算大圆轨道 - Calculating Great Circle track using latitude and longitude in Excel 使用Excel纬度和经度表创建点Shapefile - Create Point Shapefile Using Excel Table of Latitude and Longitude 链接Google地球中折线段的MS Excel纬度/经度点 - link MS Excel Latitude/Longitude points for polyline segments in Google Earth 如何使用正确的纬度/经度格式将html表导出为ex​​cel? - How to export html table to excel with correct latitude/longitude format? 如何从Excel中与值列表匹配的单元格中提取特定单词 - How to extract a particular word from a cell in excel that matches a list of values
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM