[英]Excel - Combine string from multiple columns with delimiters into one
我有以下格式的數千行:
Image ID Image Title Image Caption
4867 Bedroom Bedroom
4866|4865 Office|Kitchen Office|Kitchen
我需要從這些列中獲取相關的字符串,並將它們組合成這種格式的第四列:
Image ID Image Title Image Caption Attachments
4867 Bedroom Bedroom {"image_attachments":[{"id":"4867","fields":{"title":"Bedroom","caption":"Bedroom"}}]}
4866|4865 Office|Kitchen Office|Kitchen {"image_attachments":[{"id":"4866","fields":{"title":"Office","caption":"Office"}}]},{"image_attachments":[{"id":"4865","fields":{"title":"Kitchen","caption":"Kitchen"}}]}
有人可以建議實現此目的的最佳方法嗎? 非常感謝。
您可以使用left / right / concatenate完成此操作。 完全匹配您的語法會花費一些時間,但這是一個示例。 讓我知道您是否被卡住。 注意,為了在Excel的字符串中包含雙引號,請使用"""
:
=CONCATENATE("""{image_attachments"":[{""",LEFT(A3,4))
假設A3是包含第一個圖像ID的單元格,則輸出如下:
“ {image_attachments”:[{“ 4867
在單元格中只有一個Image ID的情況下完成此操作之后,我將整個內容包裝在=IF(LEN(A3=4,DO THIS,IF(LEN(A3=9,DO THIS CODE),"")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.