Need help on extracting name of city from a strings in a cell to another cell

sukisukianto

New Member
Joined
Aug 2, 2022
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi..Good day to you all.

I work in the hospitality line and usually we have a Property Mangement System that take care of the reports for guest statistics, but the current PMS that I use right now does not support all the reports that I need. The workaround is to extract the data from the PMS to Excel. One of the report that I need help on is the Room Production by Guest City of Residency.

The way we enter those data is we enter the address in the profile page of guest inside the PMS, for example :

Address Line 1 : ABCD Road
Address Line 2 : No. 1A
City : City A
Postal Code : 123456
Country : Country A

The data above when extracted to Excel become :

ABCD Road, No. 1A, City A, 123456, Country A

Address Line 1 and Line 2 are mandatory to be fill up. That goes for City too, but the Postal Code does not always available to us so some guest might have this - other don't.

Now what I want to ask for guidance is..

How can I extract the "City A" from that strings of sentences and show it on another column? The current Formula that I used is

=TEXTJOIN(";"; TRUE; IF(COUNTIF(B3; "*"&$F$3:$F$17&"*"); $F$3:$F$17; ""))

1659502247356.png


But as you could see, the result shown was a mix of a few result due to the name of the road on Address Line 1 or Line 2 that coincide with name of another City. Am really in a bind now, and would really appreciate your enlightenment on this.

Thank you

Kind regards,

Suki
 
Thanks alot Zot, I've tried this code and it works well too.

Now that I have both solution for formulas and UDF. I'll mark this as Solved.

Thank you
Now I learned on how to use FILTERXML 😁
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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