Populate Another Cell with Some of the Data From Another?

SMAsh67

New Member
Joined
Jan 8, 2018
Messages
18
Hi,

I'm using Excel 2016 to create a form, I am a novice and I'd like to know...

I'm trying to find out if I can cut and paste a file name such as "file name_123456_2018_NI" into one cell, have it stay there where I paste it and have just what is before the first underscore populate another cell. The file name does have a space between the first part, as per my example "file name", if that is relevant. If this can be done, how do I go about doing this?

Thanks!
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I am a novice and have no idea how to use this. Though I do appreciate your quick response... what do I do with this? :)

No worries. Say you post your file name in cell B3. in an empty cell you put in my formula:
Code:
=left(b3,FIND("_",b3)-1)
It will return the file name up to the first underscore _
 
Upvote 0
I'm trying this out and it works great (thank you!) except I put in =LEFT(F8,FIND("_",F8)-1) and when there is no data in cell F8 I get the error #VALUE !

Can I get rid of that error or hide it in some way?
 
Upvote 0
I'm trying this out and it works great (thank you!) except I put in =LEFT(F8,FIND("_",F8)-1) and when there is no data in cell F8 I get the error #VALUE !

Can I get rid of that error or hide it in some way?

Code:
=iferror([COLOR=#333333]LEFT(F8,FIND("_",F8)-1),"")

[/COLOR]
If nothing in F8, it will return nothing
 
Upvote 0
I'm very grateful for your help! This works perfectly...

Code:
=IFERROR(LEFT(B11,FIND("_",B11)-1),"")

I was wondering, is there a way to make it show everything after the last "_"? I've been messing with it but I just can't get it to work.

The file names are never the same length. For example:

random name_17075496309_9863-7-3_9-36-27_GMC
thisone here_98634961630_1213-9-10_11-53-59_NC

But they always have 4 underscores. What is after the last underscore varies from 2 to 3 letters.

Is this possible to do?

Thanks again!
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,533
Members
448,969
Latest member
mirek8991

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