# SUM A Column With Unknown Length

Jun 26, 2012

Trying to sum up a column that has an unknown length. This is a canned Excel form that is saved within a software system and is used to create customized documents. Usually, I would enter the table name.field name in a cell to pull the data from various parts of the system.

In this case, that data resides in AA234 of my customized Excel sheet. When the user retrieves this doc from the system, the data could run several rows, starting from AA30 to AA255. So, in my "Total" cell, I've entered =SUM(AA1:AA255), so it will just add up whatever is in the column, regardless of how long it runs upon document generation. When I try to pull the document, I get "=SUM(#REF!)" in that field instead.

ADVERTISEMENT

## Select Column Of Unknown Length Using VBA

Jul 14, 2014

I have a column that begins in the same place all of the time (Cell C6) however the length of this column can vary. How can I copy the column using VBA?

## Calculate The Length Of 2 Unknown Sides Of A Right Triangle

Mar 27, 2009

I need to write a spread sheet that will calculate the length of 2 unknown sides of a right triangle using the following information.

Here is what I know
1. I have a right triangle
2. I know the length of the hypotenuses
3. I know the ratio between the length of the other 2 sides

I need to write and Excel file that will solve for the length of the other two sides

The math look like a^2+b^2=c^2

with c being known and the ratio between a and b known

## Summing Across Unknown Range In Unknown Cell

Oct 26, 2009

I've been working on a spreadsheet and these forums have been a great help. I'm now at the very last section and, surprise surprise, it's also the hardest!

I'm creating a stock trade recording sheet. I have a userform ask the user to enter a date, a time, the number of stock purchased, and the price of the stock. These are then entered in a new row.

Now what I want to do is have summary cells which say how many stocks were purchased and the total profit made for each day. Since each time is given its own row, I can't know in advance which rows to sum over. I also don't know on which days a trade was made. So a summary cell should only exist if a trade was made that day.

Could I do something like.... check if the date matches then sum over all the values for that date? So if column A has the dates, can I say "Search which rows in column A have this date" then "for those rows, sum column C"?

Also, how would I create a a row for each traded date's summary cell and enter the date in it? I've attached a spreadsheets which manually demonstrates what I want to do (no macros) and a spreadsheet with what I have so far (basic macros).

Any and all help much appreciated, I just need to get my head around creating and dealing with variable ranges. Is that a really advanced task? I don't think this is a one line solution so please bear with me while I make mistakes!

## Set Variable To Unknown Last Used Cell In Known Column

Jun 24, 2008

I'm trying to define the last row in a column which is determined from a find command. It's quite a large sub, and the rest is working properly, so I'll just post the (still rather large) troubling section.

'startingPoint is declared as a range. Destbook, reporttarget and FullControlName all exist.

'this sets StartingPoint to a one cell range in a sheet named from a custom class in a workbook named from variable destbook

Set StartingPoint = DestBook.Sheets(ReportTarget.Name).Cells.Find(what:=FullControlName, searchorder:=xlByColumns)

WriteCol = StartingPoint.Column

'this changes the range to include the whole column of the existing range
Set StartingPoint = Range(StartingPoint.EntireColumn.Address).....................

## Total A Column With Unknown Number Of Rows

Jan 24, 2007

In the code below, a formula is placed in column F to compute the total of that column. I first find the number of rows and place the formula in the cell below it. I'm dividing the sum by 2 since there are subtotals in the column.

Sub AddColumn()
Dim NumRows As Long
NumRows = Range("A65536").End(xlUp).Row 'get the row count
NumRows = NumRows + 1
Worksheets("Report").Cells(NumRows, "F").Value = "=SUM(F9:F308) / 2"
End Sub

The problem with the code is that I don't really know that the last row in the column is F308. I need to replace that part with a variable. It will be something like this (which I know is incorrect):

Worksheets("Report").Cells(NumRows, "F").Value = "=SUM(F9:NumRows) / 2"

How would I use a variable in the SUM function in place of the cell names? Should I even be placing the formula in a cell, or should I compute the sum in the macro and place the value in the cell?

## Formatting Unknown Ranges Based On Contents Of A Column

May 19, 2009

i can't seem to figure this one out.

I attached a file showing how i am trying to format data (the second tab).

The big issue is the counting to format. (the formatting itself is obviously easy.)

The number of columns is not always standard so i need to count for it.

the number of rows in each "room number" is also not always standard, which means i also need to count for those.

If anyone has had experience trying to do something like this i would appreciate the help.

i know it is possible because i had one that someone had given me years ago, unfortunately i lost it in a hard drive failure...also years ago.

if it isn't obvious what i am trying to do, let me know and i will try to be clearer.

## Finding Withing Part Of Unknown Sized Column

Jan 12, 2008

im trying to find and delete records within a column if they occur twice. this works great right now but I want it to exclude the top 8 rows... i think it might have something to do with the LookAt:=xlPart constraint ...

## VBA Code To Set Unknown Range Based On Current Date In 1 Column

Jul 21, 2009

i have a sheet for monitoring sickness. i have used a macro before which automatically selects a range and emails it to recipients when i press a button. what i would like to do is have excel automatically choose the range for me based on today's day. in the attached example i would like column "A" copied along with the 5 columns before today's date, today's date column and also the 5 columns after today's date. paste the lot into an email and send. (i have highlghted the parts i would like copied and pasted into an email based on today's date (21st july).

## Shorten String Length If Exceeds 31 Characters (max Sheet Name Length)

Mar 27, 2014

I've set up a filing system which saves sheets/ workbooks based on the value of a cell - Range("B1") Everything works great apart from when ThisFile String length exceeds 31 characters which you may know is the max useable character length for a sheet name - I had no idea! 8-0

Is there a way i can check if string length exceeds 31 characters then, if it does, shorten it to 31 characters?

[Code] .....

## Formula Code To Find Arc Length From Chord Length

Sep 4, 2012

How to create a code formula to calculate the arc length from a given chord length?

If you know the radius of the major circle.

Say the chord is 50mm and major circle dia is 72mm (radius 36mm)

arc from chord.jpg

## Give Cell A Value Based On Length Of Row (variable Row Length)

Jan 9, 2010

My worksheet contains data with the reaction times on a psychological test. Each respondent in the test has 280 rows in my excel sheet.

The 'perfect' length of the row, is from A to M. When an error is made in the test, the length of the row will increase. So the error length can be A to AA.

For me it is important to analyse the error. So I would like to give a perfect row length, the value 1, and an error row length a value 2.

So, in conclusion:

If:
Cell length = A1 - M1? --> Copy A1 B1 C1 (A B Cof that row) to Sheet3, and give D1 in sheet 3 the value 1

Cell length >= A1 - M1? --> Copy A1 B1 C1 (A B C of that row) to Sheet3, and give D1 in sheet 3 the value 2

## Edit Length Based On Other Column

Oct 28, 2011

I have two columns, one with an account number (call it A) and another with a vendor id (call it B). I need the length of the number in column A to be truncated to 10 characters by just deleting any additional characters after 10. That should be based on whether or not the corresponding cell in column B equals the following number "147212336". Right now, my code edits the ENTIRE column A, not just the cell in the same row.

I know it's because I'm using a "FOR EACH CELL" argument but I don't what else would work.

Code:
Set acctlengthrange = Range("N2", Cells(LastRowB, "N"))
Set dplrange = Range("P2", Cells(LastRowB, "P"))
With dplrange
If cell.Value = "147212336" Then
For Each cell In acctlengthrange
cell.Value = Left(cell.Value, 10)
Next
End If
Next

## Selecting Range 6 X The Length Of Another Column?

May 15, 2012

I have a worksheet which already has some built in formulas which take the data in columns V and W, and use them to build other coding in column P. The trick is that the coding created in column P will be six times as long as the source data in columns V and W.

I.e., a single row containing "Sample1" and "Sample 2" in columns V and W respectively create the six following rows in column P:

Row 1:
Row 2: TMUnknown
Row 3: tested1
Row 4: Sample1
Row 5: Sample2
Row 6:

I want to be able to select the accurate length of Column P, which should be 6x as long as columns V or W. Any dynamic way to do this? (Since the amount of data pasted into columns V and W will change each time I use this worksheet.) I know how to select set ranges, but not how to adjust them as multiples of the length of another column

## Cut Text Data To Length Down Column

Dec 25, 2006

I have a range of text data in a column and need to get the text lengths to no longer than 60 characters.

The remaining data then need to be copied in a cell inserted below the original.

I have been playing with the following code�

## Isolate The Width And Length Of Column

Feb 17, 2009

Hello All:

I have the following type information in thousands of cells. I need too isolate the Width and Length from these cells. The width and the length are the two numbers on each side of the "X".

RAPITONE C2 10 X 10 100
RAPITONE M2 10 X 10 250
RAPITONE M2 10 X 10 250
RAPITONE M2 10 X 10 250
RAPITONE M2 10 X 10 250
RAPITONE M2 10 X 10 250
RAPITONE M2 10 X 10 250
RAPITONE M2 76 EI 42 X 100 ROLL

## Character Length Limit In Column In Excel?

Dec 16, 2013

Formula on how to limit character length limit in a column in excel. I would like to limit the column to 32 characters

## Computing With Last 252 Rows Of Varying Length Column

Nov 26, 2009

Using Excel 2003, Column E has a varying and unpredictable number of rows, which only the final 252 rows are of significance. I need to compute the following formulas, here written in English as I can't determine the proper terminology to accomplish this task in Excel:

Final Row with a number in Column E/average (final 252 rows with numbers in column E)+

Final Row with a number in Column E/average (final 126 rows with numbers in column E)+

Final Row with a number in Column E/average (final 63 rows with numbers in column E)

Once again, what makes this not straightforward for me is the column may have wildly varying numbers of rows.

## String In Column A To Be Divided Into 2 Strings If Length > 50

Apr 8, 2013

I have a set of data in Which in column A is the name of organisation.

If string in col A is longer than 50 I need to split in and put in col B.

That would be simple however I need to do it in a smart manner: i.e. cut it to the nearest full word.

Example:

THIS EXAMPLE NAME IS TOO LONG TO FIT INTO 50-TEXT CRITERIA SO I NEED TO DIVIDE IT INTO TWO STRINGS

Incorrect; length = 98

THIS EXAMPLE NAME IS TOO LONG TO FIT INTO 50-TEXT
Correct; trimmed down to 48.

My question is about formula that can detect spaces and depending on those trim the string down adequatly:
to 50 if 50th char is preceeded by space; if not then check where is the next space going towards left. Once you find it cut the string there.

What formula I can use to get desired effect?

## Converting Different Length Rows Into Single Column

Jul 29, 2014

I have a table in excel in which every line has as many values as the days of the month (e.g. 31 values first row, 28 the second..) and it goes from January 1948 to July 2014. So it ends up having around 800 rows.

I need to put all of those into a column, but it gets hard because the rows have different lengths. I have seen in this forum some solutions that apply well when the table is regular, but I'm stuck in trying to get a solution for when it's not. I have tried to record a macro using TRANSPOSE, but then I cannot change the cells into this formula in the editor in order to create a loop.

I also have to consider leap years.

## Separate Contents Of Column Of Numbers Based On Their Length?

Mar 5, 2013

I have a spreadsheet with numbers like this

9404388
9404374
9404391
9405695
38301663
9409724
1791016
9435145
9530758
9440464
9441182
71000569
9467438

There are a thousand numbers like this, I was wondering how I can move the cells with 7 numbers to the right column, and keep the cells with 8 numbers where they are (or move them to the 3rd column to the right)

## Sort Column Of Variable Length Alphanumeric Characters?

Aug 2, 2012

I'm trying to sort by a column with one to four digit numbers, any of which may be followed by a single letter, i.e. 1,2,3 4A,5, 10,11A,75,101A,600,705,1010B,1011A.

I'd like them to sort in the above order. I am only able to have excel 2003 sort all of the numeric cells first, followed by the cells with the alpha character.

## Adapting Macro For Variable Column Length / Range END

Apr 21, 2013

I've recorded this Macro to sort the cells in a column alphabetically if any cells have content.

I would like to use the Macro on the whole workbook however the AB column range varies between the worksheets.

How should I adapt this Macro to sort simply to the END of AB column??

' PWRII Macro
'
'
Cells.Select

[Code]....

## SUMIF- Column Of Contract Numbers Of Varying Length

Mar 27, 2009

I have a column of contract numbers of varying length. I want to run a sumif of all of the values on my reference sheet that have the contract number beginning with the contract number in my listing. All of the the contract values in my reference sheet are very long. Since the numbers I am working with vary in length, i don't know how to match this string in the sumif function

I want something like this

=SUMIF('Reference Sheet!\$A\$5:\$A\$13410,LEFT("", LEN('Select Contracts'!\$C6))='Select Contracts'!\$C6,'FINALIZED DATA'!\$H\$5:\$H\$13410)

Is there a way to refer to the range in the sumif function,

## Sort Column By Count/length Of Cell Characters

Dec 30, 2008

Ive written the macro below to sort Column A according to the length of the cell values in Ascending order. Ive done this by writing the length to Column B for each value and then sorting on column B. Surely there is a more elegant method, perhaps using arrays.

Sub SortIt()
Range("A1").Select
Do Until IsEmpty(ActiveCell)
ActiveCell.Offset(0, 1).Value = Len(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
Columns("A:B").Sort Key1:=Range("B1"), Order1:=xlAscending
End Sub

## How To Use * With Unknown Text

Oct 6, 2008

i need the same result as in table bellow (yellow column)

I need tipe "Voice" if it word conteind in text

I used ( =IF(D8="VOICE*","voice","data") )

But it doesn`t work

## Unknown Characters

Apr 20, 2009

Using web queries i get in a cell ie:
3�
or
1�
The last part of these "numbers" (3/4, 1/2, 1/4) is text that i want to convert into numbers (0.75, 0.5, 0.25).
If i isolate this text in a cell (with the right() formula) the code() formula gives 63 as result for all the above texts.
I may solve the problen storing these texts (3/4, 1/2, 1/4) in separate cells (pre-fixed in some cells) and then for my new data (from query) do some search/find .
Is there a better way solving this using a different way-macro?

## Use LINEST In A Way In Which X Values Unknown?

Jun 23, 2014

is there a way to use LINEST in a way in which the x values are unknown and the y values are known? The opposite of how the function usually runs...?

## Unknown Cell Entry

Sep 17, 2009

I am using a spreadsheet written by someone else that contains a type of cell entry I am not familiar with. These occur in several tables. The first 3 columns of each table contain numbers or basic formulas. These are followed by two columns in which every entry appears to be the following:

{=TABLE(,B33)}

Despite the same apparent "formula", the number displayed in each of these cells is different. If I click on the formula display box (to the right of the cell address box) to edit the "formula", the brackets disappear.

Can anyone tell me what sort of beast I am dealing with here?

## Unknown Popup (not A Dialog Box)

Dec 31, 2009

I'm modifying a template that originally shipped with Excel 2003 (I have not upgraded to 2007). In the template, there is a pop-up box (not a dialog box) that shows up when I'm on certain cells. I've attached an image of it. It's the yellow box containing the words "Company Information..." etc. I cannot find any way to remove it! It's not a comment, and selecting it doesn't allow you to edit it. What is it, and does anyone know how to remove it?

Copyrights 2005-15 www.BigResource.com, All rights reserved