# Formula To Trim And Adjust Data

May 1, 2014

In need of a formula to trim data:

Examples:

* 5 Extravagant Mak (nz) (100) Need the number plus a dot then space then the name, then minus everything after the name, so this would now read 5. Extravagant Mak thats 5dot space Extravagant Mak
*
11 Frisbee (100) This one would become 11. Frisbee thats 11dot space Frisbee

## Trim Macro: Trim All Of The Data From Rows 2:30 Removing Any Trailing Spaces After The Last Word In Each Cell

Apr 25, 2007

I have come up with this to Trim all of the data from rows 2:30 removing any trailing spaces after the last word in each cell. The macro takes a couple of minutes to run have I got something wrong that is making it run slowly or does the Trim process just take longer?

Sub TRIM_RANGE()
Dim myRange As Range
Dim myRow As Range
Sheets("CAMPAIGNS_2007").Select
Set myRange = Range("2:30")
If myRange Is Nothing Then Exit Sub
Application. ScreenUpdating = False
myRange.Replace What:=Chr(160), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
For Each myRow In myRange.Columns
If Application. CountA(myRow) > 0 Then
myRow.TextToColumns Destination:=myRow(1), _
DataType:=xlFixedWidth, FieldInfo:=Array(0, 1)
End If
Next myRow
Application.ScreenUpdating = True
End Sub

## TRIM + IF Formula

Mar 9, 2009

I am trying to make a simple quiz on a spreadsheet which will provide the score immediately the player has finished. Basically a row is as follows:

C5= Question; D5 = player's input answer, E5 = check answer and give score

For example:
in C5 "What colour is a banana?"
The player inputs the answer to D5: yellow
in E5, the answer is tested by a formula and score is given. For this I have a formula IF(D5="yellow",1,0) hence E5 returns either 1 or 0.

Now my problem: If the player inputs one or more spaces, I need to use the TRIM function as well otherwise the answer will be incorrect. How can I work the TRIM with the IF formula?

A thought has just occurred to me that I might have to firstly Copy and TRIM the answer in to E5 and then have the IF condition in F5, but that needs another column and seems a longer way around.

## Formula To Trim Last Name And First Name?

Apr 30, 2012

I'm in need of a formula that would trim a name within a cell to look like this:

name in cell = Doe, John
Result looking for = DoeJoh

or

name in cell = Smith, Robert
Result looking for = SmiRob

The formula would take the first 3 letters of last name and combine them with the first 3 letters of the last name. There is a space after the , and the name would always be consistent with the exampel above.

Also what about a formula that would take a name like Doe, John and transpose it to John Doe.

## Trim Formula: Separated By A Colon

Oct 23, 2008

I have been using the following formula's to trim some information that's separated by a colon, such as Pioneer Clinic:Dave McAfee...so that I have a column with Pioneer Clinic and a column with Dave McAfee:

=LEFT(G5,FIND(":",G5)-1)
=TRIM(RIGHT(G5,LEN(G5)-FIND(":",G5)))

However, now some of my data is separated by two colons! AVM:Pioneer Clinic:Dave McAfee. the formula for separating this so I still have two columns of Pioneer Clinic and Dave McAfee?

## Trim And Clean Function But Formula Doesn't Work?

Jan 31, 2014

I'm coping and pasting data (html) into a worksheet. When I try to format some of the columns as accounting\$, number, ect. They won't format. It looks as if there are spaces before and after the data. So I tried the trim and clean function but it doesn't work, so I guess the blank "spaces" are not really spaces.

It gets better...

When I do the same exact copy and paste (as html) on another persons computer, they are able to format just fine, and the "spaces" are removed automatically.

Why is this working on one computer but not the other? Is it a setting that my computer has enabled or disabled? If so, what is it?

## Adjust Simple Formula To Find Last Row

May 8, 2009

I am using this formula in Cell J12: =AVERAGE(\$G\$12:\$G\$85)

It will always be \$G\$12 but \$G\$85 needs to be done so that it goes until the last empty row on the worksheet.

May 28, 2014

I've posted a document in which I'm trying to calculate the weekly headcount for employees using their timecard entries.There are many entries per week for each employee, but I want to count them only once per week rather than each time they make a timecard entry. I need to tweak it to deal with one condition that it currently doesn't handle.The person who provided has said he doesn't check in with the forum very often, so I'm putting this out there to a wider audience.

Whenever the value of column W = "UTO" (unpaid time off) I want the formula to ignore that entry (count it as 0 rather than 1) and continue on to the next entry. The way I have the formula now, it counts any "UTO" entries as 0, but then it does not count the subsequent non-UTO entry as 1. I'm not expert enough to fully understand the formula that was provided

--(COUNTIFS(B\$2:B945,B945,U\$2:U945,U945)=1).

I have added embedded the formula in an IF statement to ignore the "UTO" entries.

=IF([@[Util?]]="UTO",0,--(COUNTIFS(B\$2:B945,B945,U\$2:U945,U945)=1)) ("Util?" is the header for column W)

## Adjust Formula To Show A Selected Day Of Week?

Feb 25, 2014

I have a formula that displays the 1st monday of a month, I need the formula to take into account which day is selected and then display the first of the selected days date for the month.

=DATEVALUE("1"&G7&G5)+IF(WEEKDAY(DATEVALUE("1"&G7&G5),2)=1,0,8-WEEKDAY(DATEVALUE("1"&G7&G5),2))

Is there any way to adjust it to do this the drop down box for the day will be in F9.

## Adjust Formula To Allow For Changing Sheet Reference.

Nov 22, 2009

I was using the formula below which was working fine for copying across 20 columns and down however many rows, but now the requirements have changed to 90 columns. I have tested this out with the 90 columns but the Indirect function is bogging down the spreadsheet with the constant recalculating.

=IFERROR(INDIRECT("'"&COLUMNS(\$A\$1:A\$1)&"'!P"&ROWS(\$A\$1:\$A8)),"")

I rearranged the formula to the one below, but how can I have the reference to the sheet name changed as in the formula above without using the Indirect?

=IFERROR(INDEX('1'!\$A\$8:\$AT\$115,MATCH(\$A3,'1'!\$A\$8:\$A\$115,0),MATCH("PAT",'1'!\$A\$7:\$AT\$7,0)),"")

The sheet reference will change from '1' through '90'.

## Adjust Range Within Formula To Get Expected Results?

Dec 13, 2013

I have a system that generates 4 databases with different types of statistical data. Observed defects, Calculated Defect, Capability and Number of points. I have set up a system for telling me what ranges each section is and I am manually changing the ranges to get my expected results.

Is there a formula that I can use that could adjust my ranges, within my formulas?

## Formula To Adjust Based On Target Cell

Mar 11, 2007

I have a spreadsheet at work . I am tracking the quality target for the department and I need to create a formula that adjust accordingly to the target set for month end which is 90%.

I have build in the foreacasted numbers for the whole month but I need the formula to indicate the minimum error points needed to achieve the target of 90% for month end when I replace the forecasted numbers on a daily basis with actual numbers.

I have attached the spreadsheet which will be clearer.

## TRIM All Data In Cells

Dec 29, 2011

I have a sheet. I want trim all the data in cells

I will select particular range and that range should get trimmed and It better to turn in colored which soever cell get trimmed.

## How To Trim All The Spaces From Data

Jan 11, 2012

Normally I would use trim or substitute to get rid of the spaces from the data. However, this time, they all don't work.

some samples below. : some numbers are text version, some are numerical numbers.

So, are there any other ways to get rid of the leading space as well?

Oper.999971240999903554 3554 1179 1240 346799990 614 3467 614 614 614 2440 3467 614 3467 614

## Data Cleansing TRIM Spaces

Apr 20, 2007

Suppose I have a list (mine is several thousand lines) with city names. In this list some has manually input some names with double spaces between multiple word names -- Example (using dashes to represent spaces in this case):

Maple-Grove
Maple--Grove

I know about the function TRIM, but that only works at the start or end, I need something simple to trim the extra space between two words.

## TRIM Not Working (data With Spaces)

Apr 30, 2008

My V-lookups are not working. I have data with extra spaces before or after the word. The table I am looking up does not have extra spaces. I'm trying to to a TRIM(data with spaces) and then copy and paste the values so that the spaces go away and the TRIM is not taking my spaces out.

## Concatenate Two Text Fields BUT Left Adjust First Field And Right Adjust Second Field

Jun 22, 2012

I want to concatenate two Cells into a single cell BUT have the first field left justified and the second cell right adjusted.

A1 = "John Williams", A2= "Single"

A3 = "John Williams Single"

Apr 4, 2008

I'm using a template that has formulas using a \$ sign to attempt to stop the ranges they refer to changing. The problem is, when I use the template (which involes Access importing some data and adding columns to the sheet the formula refers to in the process) the rows referred to in the formula change in line with the number of rows of data that have been imported. Only the row numbers change not the column headings. So for example:

becomes

## Trim Special Characters In Cell To Be To Split Data Into Columns?

Apr 9, 2014

This formula I want to apply it in another workbook. It split in different columns the content of a cell.

The formula is below:

[Code] .....

In cell A2 I have the following data:
|516582-001-99|414816-001-99|414816-003-99|516582-001-99|

If I apply the formula above in cells B2 to E2 it returns a blank cells. But if I delete the first "|" sign in the left side manually the formula works perfectly by splitting the cell into columns from B2 to E2. The issue here is that I have more than 300,000 records. Just imagine the amount of time invested in just deleting the first "|" at the left side.

I need a variation of the formula above that in first place delete the first "|" at the left side and after that continue with the proper work of the formula.

## Adjust Data Range Without Manually Filling Down

Dec 17, 2008

The below formula is in Col F6, how do i get this formula to adjust to data range without manually filling down, my data changes everyday therefore i need the formula to auto fill according to data range.

=IF(ISBLANK(E6),"",Summary!\$I\$2-E6)

## How To Set Table Range To Automatically Adjust To Source Data

Oct 17, 2013

How or if it is even possible to have a table automatically adjust its range or the number or rows it has based on another table

I have two tables:

Table1 is raw data that is added two daily

Table2 has formulas with column header references to Table1 that processes the information and converts it to a readable format. (basically barcodes to words)

Is there a way to get Table2 to automatically resize to the same number of rows that Table1 has whenever data is added??

Jun 19, 2008

Is there a way to make a chart adjust automatically when you add to the source data? I'm trying to use a named range in order to power a chart (something like chart_data=offset(a1,,, counta(a:a),counta(1:1)); the range is working fine). When I put "chart_data" into the source field for the chart, it seems to work fine; it picks up the right range... But when I later add more data, the chart source data field seems to have converted my named range into a hard-coded range, absolute range. So the dynamical named range updates, but the chart doesn't and I don't see the new data. Am I doing something wrong that I need to tweak? Does what I'm trying to do just not work? Is there another way to make the chart pick up the new data without adjusting the range?

## Adjust Macro - Imports Data From Several Input Files And Rearranges It In A Master File?

Apr 25, 2014

I have the following macro that imports data from several input files and rearranges it in a master file.I want to change it so that I can use it in each of the input files. Therefore, it should look in the input file for Spreadsheet "XYZ" and rearrange it in Spreadsheet "Data".

[Code].....

## Formula For -- If Text = 1 And Text =-1 Adjust Running Total

May 13, 2009

formula for -- If Text = 1 and Text =-1 adjust running total
example:

1312 (total)

SS1311 (new total)
LA1310 (new total)
LB1309 (new total)
LS1310 (new total)

LS =+1
SS, LA, LB =-1

## VBA Trim

Dec 16, 2008

I would like to have a simple basic VBA trim function with no complications at all. Just a simple trim vba code like:

=trim( Selected/Active cells)

But I just couldn't think of how to do it, even with recording.

## Trim / Mid / Right Etc

Aug 22, 2008

Sample of Column A:

Sat 15th Sep 07 14:15 Bath Rugby 29 - 15 Worcester Warriors Recreation Ground 10,010
Sat 15th Sep 07 15:30 Harlequins 35 - 27 London Irish Twickenham 39,400 Report
Sat 15th Sep 07 18:00 London Wasps 19 - 29 Saracens Twickenham 39,400 Report
Sun 16th Sep 07 15:00 Bristol Rugby 13 - 26 Leicester Tigers Memorial Stadium 8,125
Sun 16th Sep 07 15:00 Leeds Carnegie 24 - 49 Gloucester Rugby Headingley Carnegie
Sun 16th Sep 07 15:00 Newcastle Falcons 33 - 12 Sale Sharks Kingston Park 5,859 Report

Trying to display in column B and C:

Bath Rugby Worcester Warriors
Harlequins London Irish
London Wasps Saracens
etc....

Because of the varying length of text each time,
i'm having problems doing this.

Tried =MID(A1,FIND(":",A1)+4,25)
but obviously get extra text other than team name.

## How To Trim Words Without VBA

Jun 21, 2014

I want to be able copy certain things from cells. Is there a way to make excel copy only the name from cells containing this (One name in each cell):

VESNINA E. (RUS)
PAVLYUCHEN. A. (RUS)
KERBER A. (GER)

I basically want to cut out the (...) in all names. I could do it manually, but there could be quite a few players.

## Trim + Date

Jun 25, 2009

I would like to have in a title cell "The Week of 8/24/09 - 8/28/09". I want to use something like this

## Using Trim On A Selection

Dec 18, 2008

I want to create a macro that will allow me to highlight a column and have the macro Trim every cell with text in the column, preferably putting the results over the original text. The column in question has text in every cell, until the column ends.

(That is, there are no numbers and no blanks until the data ends altogether.) I do not want to remove internal spaces in the text, just the leading and trailing ones.

I am sure this is fairly simple, but I'm not sure how to get it to look at every cell and then terminate properly.

## Trim The Text In Vba

Jan 13, 2010

I have this code that trims cells and I would like to implement in it a way to remove line returns in cells (new lines created with alt+enter).
Below is the code I used so far: