Index Match and Remove Part of Result String

garifuna

New Member
Joined
Jun 5, 2019
Messages
4
Hello,

I am trying to trim down the results of and index match. The results from my current formula have dates with time stamp information:

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>2014-02-07 14:00:09 PST

I would like to remove everything after the space so the results look like this:

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>2014-02-07

Here is the current formula in Column L of my spreadsheet.
=INDEX(H$2:H$1319,MATCH(A2,B$2:B$1319,0))

In Column M I have this formula to trim down the results, but would rather have it all in one to save space.
=LEFT(L2,FIND(",",L2)-1)

 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
All you should need to do is replace L2 in the second formula with the INDEX/MATCH formula.

=LEFT(INDEX(H$2:H$1319,MATCH(A2,B$2:B$1319,0)),FIND(",",INDEX(H$2:H$1319,MATCH(A2,B$2:B$1319,0)))-1)

PS If the values you are looking up are 'real' date/time values you could try this to return the date.

=INT(INDEX(H$2:H$1319,MATCH(A2,B$2:B$1319,0)))
 
Upvote 0
Code:
=left([COLOR=#ff0000]index(h$2:h$1319,match(a2,b$2:b$1319,0))[/COLOR],find(",",[COLOR=#ff0000]index(h$2:h$1319,match(a2,b$2:b$1319,0))[/COLOR])-1)
 
Upvote 0
Hi,

First of all, I don't see a "comma" in your Sample "2014-02-07 14:00:09 PST", so I'm using a Space as delimiter.

Another way, result converted to Real Date value, Format result cell as Date of your choice:


Book1
ABCDEFGHIJKL
2thisthis2014-02-07 14:00:09 PST2/7/2014
Sheet673
Cell Formulas
RangeFormula
L2=LEFT(SUBSTITUTE(INDEX(H$2:H$1322,MATCH(A2,B$2:B$1322,0))," ",REPT(" ",99)),99)+0
 
Last edited:
Upvote 0
All you should need to do is replace L2 in the second formula with the INDEX/MATCH formula.

=LEFT(INDEX(H$2:H$1319,MATCH(A2,B$2:B$1319,0)),FIND(",",INDEX(H$2:H$1319,MATCH(A2,B$2:B$1319,0)))-1)

PS If the values you are looking up are 'real' date/time values you could try this to return the date.

=INT(INDEX(H$2:H$1319,MATCH(A2,B$2:B$1319,0)))

This worked perfectly. Thank you for the help!
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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