简体   繁体   English

从从公式填充的单元格中提取数据时出现问题

[英]Problem extracting data from a cell populated from a formula

I imported a txt document which creates 7 columns of data. 我导入了一个创建7列数据的txt文档。 One of the data points in the document is a MAC address, however, due to the format of the txt document (and there is no way around this), the MAC address is split up into 6 columns (BG), with all other pertinent data (non MAC addresses) existing in column B. 文档中的一个数据点是MAC地址,但是,由于txt文档的格式(并且无法解决此问题),MAC地址被分成6列(BG),所有其他相关内容B列中存在的数据(非MAC地址)

I am trying to write a formula to check a cell in column B, and if it contains "BSSID" then it will combine the text in the corresponding row from columns BG and enters the new value in column H (so it shows as a normal MAC address). 我正在尝试编写一个公式来检查B列中的单元格,如果它包含“BSSID”,那么它将组合BG中相应行中的文本并在H列中输入新值(因此它显示为正常MAC地址)。 If the cell does not contain "BSSID", then the value of that cell just needs to be moved to the corresponding row in column H. 如果单元格不包含“BSSID”,则该单元格的值只需移动到列H中的相应行。

MY PROBLEM IS given the formula below, if the cell contains "BSSID", the corresponding row in column H will only display the value of the cell in the first column, instead of all the columns. 我的问题给出了下面的公式,如果单元格包含“BSSID”,则列H中的相应行将仅显示第一列中单元格的值,而不是所有列。

I have tried taking the code, that combines cells in BG within the formula, and surrounding it in brackets and quotations, with no luck. 我已经尝试了代码,它将公式中BG中的单元格组合在一起,并用括号和引号括起来,没有运气。
I also tried making this a multiple step solution by only running the formula to combine everything in column H, and then in column I, via a formula. 我还尝试通过运行公式来组合H列中的所有内容,然后通过公式将第I列组合在一起,从而使其成为一个多步骤解决方案。
I tried to move the value returned in column H to column I, but I run into the same issue. 我试图将列H中返回的值移动到第一列,但我遇到了同样的问题。
And I have tried swapping the return values, just to make sure, I didn't mix up the true return with the false return. 我已经尝试交换返回值,只是为了确保,我没有将真正的回报与错误的回报混淆。

Original Code I would like to get to work: 原始代码我想开始工作:

=IF(ISNUMBER(SEARCH(“BSSID”,A2)),B2&":"&C2&":"&D2&":"&E2&":"&F2&":"&G2,B2)

This is what the code looked like, when I broke it into 2 parts: 当我把它分成两部分时,这就是代码的样子:

Column H: =B2&":"&C2&":"&D2&":"&E2&":"&F2&":"&G2, B2 列H: =B2&":"&C2&":"&D2&":"&E2&":"&F2&":"&G2, B2

Column I: =IF(ISNUMBER(SEARCH(“BSSID”,A2)),H2,B2) 第I列: =IF(ISNUMBER(SEARCH(“BSSID”,A2)),H2,B2)

Both codes only return the value in cell B2 if true, instead of what should look like a MAC address. 如果为true,则两个代码仅返回单元格B2中的值,而不是看起来像MAC地址的值。

My expected results would be, in a single formula, if B2 contains the string "BSSID" that H2 would show the content of B2-G2 formatted to look like a MAC address; 我的预期结果将是,在单个公式中,如果B2包含字符串“BSSID”,则H2将显示B2-G2的内容,其格式看起来像MAC地址; and if B2 does not contain the string "BSSID" then H2 will show the content of B2. 如果B2不包含字符串“BSSID”,则H2将显示B2的内容。

Actual result is that H2, when the formula returns true, only displays B2 and not B2-G2. 实际结果是H2,当公式返回true时,只显示B2而不显示B2-G2。

I would approach this problem as follows: 我会按如下方式解决这个问题:

  • Check the cell for BSSID using an IF statement =IF(SEARCH("BSSID",A2), <true>, <false>) 使用IF语句=IF(SEARCH("BSSID",A2), <true>, <false>)检查单元格中的BSSID
  • This statement may result in an error though, if "BSSID" isn't found. 如果未找到“BSSID”,则此语句可能会导致错误。 Your code looks to be fine, but perhaps herein lies the issue. 你的代码看起来很好,但也许这就是问题所在。 To be sure, we can insert a catch for the errors using IFERROR =IF(IFERROR(SEARCH("BSSID",A2), FALSE), <true>, <false>) 可以肯定的是,我们可以使用IFERROR =IF(IFERROR(SEARCH("BSSID",A2), FALSE), <true>, <false>)插入错误的catch。
  • Then, within the <true> section of the IF statement, I would use TEXTJOIN to combine my cells with a colon inbetween ...TEXTJOIN(":",TRUE,B2:G2)... 然后,在IF语句的<true>部分中,我将使用TEXTJOIN将我的单元格与中间的冒号结合起来...TEXTJOIN(":",TRUE,B2:G2)...

EDIT: I notice that you say in one location that you are checking cell A2 for "BSSID" and in another you say you are checking cell B2. 编辑:我注意到你在一个地方说你正在检查A2的单元格为“BSSID”而在另一个地方你说你正在检查单元格B2。 Perhaps make sure you aren't checking the wrong cell? 也许确保你没有检查错误的细胞?

=IF(ISNUMBER(SEARCH(“BSSID”,A2)),B2&":"&C2&":"&D2&":"&E2&":"&F2&":"&G2,B2) = IF(ISNUMBER(SEARCH(“BSSID”,A2)),B2& “:” &C2& “:” &D2& “:” &E2& “:” &F2& “:” &G2,B2)

... ...

My expected results would be, in a single formula, if B2 contains the string "BSSID" that H2 would ... 我的预期结果是,在一个公式中,如果B2包含H2将...的字符串“BSSID”

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

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