Assistance needed with formula.

pujo

Well-known Member
Joined
Feb 19, 2009
Messages
708
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
Trying to create separate formulas to extract substrings from a cell.
My application exports to a csv and combines data from different areas, putting into one cell.

I would like to split the data like this.

Example: {A1} = 192.168.1.1:eek:bi.OPC.1:Analog Item '123-10.5555' Bits 2
{B1} = 192.168.1.1
{C1} = obi.OPC.1
{D1} = Analog Item
{E1} = '123-10.2222'
{F1} = Bits 2

I was able to get the first two substrings but having trouble getting the remaining.
Formula: {B1} =LEFT(A1, SEARCH(":",A1)-1) 'IP Address
{C1} =MID(A1, SEARCH(":",A1) + 1, SEARCH(":",A4,SEARCH(":",A1)+1) - SEARCH(":",A1) - 1)

Appreciate any assistance !!

PuJo
 
I am looking up the FILTERXML function to try and learn how to use it.
Any recommended literature?
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
@Fluff

Thanks for the assistance this morning with the filterxml function.
For the last couple hours I have been trying to figure it out so that I can add characters to the formula.

Would you mind explaining the theory of operation for the formula?

How would I go about adding the curly brackets along with the < symbol similar to the way you added the "<","&lt;"
'333-10.Barometer{-1:100}' should be in one cell but its splitting after the colon.

Thanks again!

SCADA_DATA.xlsb
ABCDEFG
110.10.1.10:asi.OPC.1:Analog Item '333-10.ActualInterval<C1>' Bit 210.10.1.10asi.OPC.1Analog Item'333-10.ActualInterval<C1>'Bit 2
210.10.1.10:asi.OPC.1:Analog Item '333-10.Barometer{-1:100}' Bit 510.10.1.10asi.OPC.1Analog Item'333-10.Barometer}-1100}'Bit 5
Sheet5
Cell Formulas
RangeFormula
B2:G2,B1:F1B1=FILTERXML("<k><m>"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A1,"{","}"),"<","&lt;")," '",":'"),"' ","':"),":","</m><m>")&"</m></k>","//m["&COLUMNS($B1:B1)&"]")
 
Upvote 0
Will the : in the {} always be followed by a 1
 
Upvote 0
Yes, every bracket in the worksheet is the same. Brackets are only used for the Barometer tags, i.e. '333-27.Barometer{-1:100}'
 
Upvote 0
In that case use
Excel Formula:
=FILTERXML("<k><m>"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A1,"<","&lt;"),":1","&#58;1")," '",":'"),"' ","':"),":","</m><m>")&"</m></k>","//m["&COLUMNS($B1:B1)&"]")
 
Upvote 0
Solution
Perfect!

Would you mind explaining the theory of operation for the formula?
 
Upvote 0
Unfortunately it's not that easy to explain.
 
Upvote 0
Gotcha!

I appreciate all your time helping me out with this.
It's going to save me hours of work!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top