Obtaining substring from a string; multiple entries

aalex10

New Member
Joined
May 22, 2015
Messages
2
Hello all,

I've been trying to figure this out for a little while and thought that I would just ask for some help.
My data looks like the following:

A1= 1/5/2015
A2= 2/6/2015
A3= 3/7/2015

B1= Playground A / School A (Project 123)

B2= Playground B (Project 91); Playground C (Project 8)
[FONT=arial, sans, sans-serif]B3=School B (243), School C (231)[/FONT]

[FONT=arial, sans, sans-serif]Each site has a name and unique project ID# and is ordered chronologically by the event date. (I found a nice script online for pulling google calendar events into google sheet: see my script below). However as you can see, it is not consistently entered and some lines have more than one entry. Also, the ID#s are not necessarily the same number of digits (ex: 1, 12, 123).[/FONT]

[FONT=arial, sans, sans-serif]I am looking for a way to extract the ID# from each string and then pull the most recent date from the adjacent cell. I was thinking along the lines of an index//match and maybe a wildcard function; or [/FONT]I was looking for a way to find ")" and then search backward for the number. [FONT=arial, sans, sans-serif]I am still unsure how to wrap my head around it.

Any and all help would be appreciated. Thanks!

Script I plugged into google sheets:

[/FONT] function listEvents() {


var today = new Date();
var Calendar = CalendarApp.getCalendarById("NAME OF MY CALENDAR");
//var Calendar = CalendarApp.getDefaultCalendar();




var events = Calendar.getEvents(new Date(today.getFullYear(),1,1), new Date(today.getFullYear(),12,31));

var eventarray = new Array();
for (var i = 0; i<events.length; i++)
{
var line = new Array();
line.push(events.getTitle());
line.push(events.getStartTime());
line.push(events.getEndTime());
line.push(events.getLocation());
eventarray.push(line);
}

var sheet = SpreadsheetApp.getActiveSheet().getRange(2, 1, eventarray.length, eventarray[0].length).setValues(eventarray);
}
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I would want to identify the numbers: "243" and "231" and then be able to match it from a separate list of sites that correspond to it. (Example of list: (Cell1=Name, Cell2=ID#...etc) Cell1= XXX School Cell2=243)

B3=School B (243), School C (231)

C3= 243
D3= XXX School

E3= 231
F3= YYY School
 
Upvote 0

Forum statistics

Threads
1,215,459
Messages
6,124,944
Members
449,198
Latest member
MhammadishaqKhan

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