# Sum Range Defined By Reference Cell

Aug 1, 2008

I have a list of numbers in Column A and in Column B I have a standard Sum formula which sums the adjacent number in Column A and the four numbers before it.

A B

1 =Sum(A1:A5)
3 =Sum(A2:A6)
5 ...
3 ...
5
6

I would like to have a formula which references another cell to define how many rows to sum from the starting cell. So in the above example, the total number of rows which are added together is 5. If I wanted to change all of the SUM formulas to add 6 rows, I would like to be able to change the number in the reference cell to 6 and all of the sum formulas would switch to adding 6 rows.

## Cell Reference Used For Defined Range

Oct 28, 2009

In the attached sheet. Cell C6 represents the concatenation of aspects of a product. I want to know if it is possible to use that cell as the named range (there is a corresponding named range) in a lookup. The lookup gives me the product code.

## Cell Reference Or Defined Name For A Sheet

Jan 13, 2009

I'd like to be able to refer to a cell or local scope defined name within my sheet that references another sheet, or accomplish the same functionality in some way.

For example, if I have a sheet MyInformation and then another sheet MyPrintedInformation, where the printed information sheet shows MyInformation in a more printer-friendly format, I might have this in MyPrintedInformation:

a cell or defined name that says (this doesn't work, but just as an example):
let's call the named variable TheSheetToPrint
='MyInformation'. Then from within MyPrintedInformation all of my references look like this

Some cell :

=TheSheetToPrint!A2

## User Defined Functions And Cell Reference

Feb 28, 2012

referencing constant cells in custom functions. This is a sample of my code:

Code:
Select Case Name
Case Is = "Ball"
Valve_Days = [V4] + Cushion
Case Is = "Check"
Valve_Days = [V5] + Cushion

Now, the problem is when I open the workbook up, or someone downloads the file from the server, it resets all fields to div/0 based on what sheet the last user 'Saved' the document on. I think this is occurring because it doesn't know which sheet to pull the value V5 from? The problem never started to happen until I added another sheet in the workbook. Is there a way to tell VB that it isn't just cell V5, but it is cell V5 on Sheet 'X'?

## Application-defined Or Object-defined Error :: Add Named Range At Run-time

Oct 4, 2006

Trying to add a named range at run-time

Here's what I have so far ...

## Range Selection Error (application-defined Or Object-defined)

Jun 9, 2009

I am having some trouble with a variable range selection within a regression. I keep getting an "application-defined or object-defined error." I've isolated each statement to find that the code that is causing the regression not to work is below (the error for that line of code states that the Select method of Range class failed):

## Application-defined Or Object-defined Error :: Range & Offset

Feb 26, 2009

this is the line it gives the error on.

Range("A1").End(xlDown).Offset(1,0).Select

## Application-defined Or Object-defined Error Using Range

Jun 5, 2009

So I'm correcting macro at work and keep running into this error:
"Application-defined or object-defined error"

## Name Last Cell In Defined Range

Sep 12, 2007

In several places in my code I need to define ranges and save them in Application.Names. I need to be able to reference the last row and column in that range but I don't know how. Is there a reference within the Range object for the boundaries used to create it?

ie, the B3 in Range("A1:B3")

Not all of the ranges will have content in them and many of them will overlap, so looking for the last non-blank cell won't work.

## MAX Value In Range Of Cells Defined By Value In Another Cell?

Dec 20, 2013

I need to obtain the max value in a column of numbers (DJ3:DJ242) with the range of the cells considered, set by a slider that produces a value between 1 and 500 in cell BD51

## How To Assign Range Using Defined Cell In Excel

Nov 22, 2011

How to assign a range in excel using a defined (different) cell.

I've this formula
=INDEX(\$A\$1:\$A\$17,RANK(B2,\$B\$1:\$B\$17))

I want to to choose the range from A1:A17 ... i'll use the formula too many times with different ranges for example A1:A21 and i want to know a way to insteed to change it manually each time to make the formula consider the value i insert in a different cell, so i can only change the value in this cell.

for example:

=INDEX(\$A\$1:\$A\$D1,RANK(B2,\$B\$1:\$B\$D1)) so it can consider the value in cell D1

## Auto Fill A Cell With A Value Based On Pre-defined Range

Mar 19, 2013

A have three columns with "Kilograms range" and corresponding value.

A========== B========== C
KG From====-To======= Predefined Value

what formula will fill up the cell with the predefined value automatically based on the range, after a kilograms are entered in a different cell as explained in the attachment.

## Create Macro To Run In Selected Cell For Defined Range?

Jan 11, 2013

I created a named range formula:

=TEXT(TODAY(),"m/d/yyyy")&" "&TEXT(NOW(),"h:mm AM/PM")

The goal of that formula was to return a Date/Time stamp that is fixed and doesn't change over time. The formula is intended to run in which ever cell that I select to enter it into. I named the formula:

=DS

What I am trying to do is create a macro that will run the formula using a hot key function. I want to be able to select a cell and hit CTRL D and have that above formula run in that cell. I have multiple sheets in my workbook and I need the macro to be able to run on any sheet in my workbook. Below is what I have:

Sub DateStamp()
'
' DateStamp Macro

[Code]....

I was trying to apply the macro to only a certain range of cells on any given sheet.

## Indirect Reference To Defined Name

Feb 17, 2012

Reduced to it's simplest form I have a formula

=1*(FY2012_TY), where FY2012_TY

is a Defined Name which refers to a column on another tab in the workbook, and is defined as:

=OFFSET(Table!\$AA\$3,0,0,COUNT(Table!\$AA:\$AA),1)

What I would like to do is to come up with an approach to this formula that would allow me to drag it across columns and have the year automatically increment (e.g., FY2013_TY, FY2014_TY, all of which are similarly defined Defined Names referring to adjacent columns). I have tried various approaches using INDIRECT along with CONCATENATE, but when it comes down to evaluating the formula, I consistently get a #REF! error.

## Application-defined Or Object-defined Error On An Active Cell

Nov 22, 2008

I have a very strange problem in DEBUG mode, because i get this error "Application-defined or object-defined error" when referring to a cell and assigning it a value so it goes to my error handler and i have a Resume Next there. It continues to go through the code whilst continuing to go to the error handler but when i step out of the function it restarts again from the beginning on the called function and then on the second run of my code it seems to WORK!?! So i'm thinking what the hell is going on, it falls over and fails the first time round and works the second time round?
In free-run mode from excel i just get a #VALUE!

## VBA Macro - Copying Entire Row From Selected Cell (within Pre-defined Range)

Jun 21, 2014

I am looking to run two separate macros. I have a project plan and I am looking to be able to select a button whereby on-click, a new row is created within a selected cell. However if the cell clicked is outside of a pre-determined range, then the task is automatically entered at the bottom of the plan. I would like for the copied row to go ABOVE the selected cell and have all of the same formatting as the row below (not the top - as is default in Excel).

The second is going to be very similar but will copy a task category (like a header item) and the first task (row) found below. It will also be copied from below and be inserted above the selected cell.Both macros will clear certain cells, whilst maintaining the contents of others, with formula contained. I.E. Columns C,D,E,H,I,J will be cleared.

## Defined Names Vs Reference Cells?

Mar 23, 2012

I have several SumIf formulas that references a Cell in a Main Reference Tab. This is useful to me as I have over 100 tabs of data points and having a reference cell with that text is easier to change one time vs 100 times.

My question is this: Will Defined Names be "faster" than using a reference cell? With over 100 tabs, there's a lot of formulas and I'm looking for a faster way to get the same output without Excel Memory overload.

## Retrieving Cell Values Based On User Defined Number Range?

Mar 31, 2014

So I have 2 sheets from a much larger worksheet where I wish for the first sheet to extract a row of values, one at a time from the second sheet using a range of numbers I enter as reference for where to look for the data. Sheet 1 can be thought of as a summary page and Sheet 2 is where data is stored.

I need to first check if any data under Sheet 2 column B fall within a specified range of numbers and if any of those numbers are found I want it to grab the largest and latest number from that range and pull all the data from certain columns in that same row and place it into Sheet 1, one column value at a time.

Sheet 1 A1 = A range of numbers as text. 10-15, 16-20 etc Only one range is entered. This also tells me what results I'm looking at.
Sheet 1 B4:B14 = Destination cells for the individual data I'm wanting to pull from Sheet 2 columns H:P. B4 wants H, B5 wants I, B6 wants J etc

Sheet 2 column A = A3:A102 are numbered 1:100.
Sheet 2 column B = A series of numbers anywhere from 10-70. Always in sequence and they can repeat. 10,10,11,12,13,14,15,15,15,16 etc. Ranges from B3:B102. Only one number per cell.
Sheet 2 columns H:P = Data in H3:P102 I want to extract to Sheet 1 B4:B14.

Now lets say I want a formula for Sheet 1 B4 which wants a value in Sheet 2 H. If Sheet 1 A1 = 10-15, I want to check whether Sheet 2 column B has any values equaling those and then tell me which row that last number appeared in.
Example: Sheet 2 B4=14, Sheet 2 B5=14, Sheet 2 B6=16. Use B5. (B6 is outside range and B4 isn't the last time the 14 appears.)

Then, knowing B5 is the value I want, find which row it is in (row 5 in this example) or use the number in A5 (3) and then find my way to column H (H5) where the value I want to pull is.

Example 2: Sheet 2 B4=14, Sheet 2 B5=14, Sheet 2 B6=16. Use B5.
Sheet 2 H4=10, Sheet 2 H5=32, Sheet 2 H6=42. Place "32" from H5 into Sheet 1 B4.

I'd like to also have some error control so I'm not trying to pull data from blank cells if it's relevant. Maybe check if Sheet 2 X3=0 and if it is, do nothing as no data appears if the cell is 0.

I have put a lot of time into trying to solve this myself but I feel way out of my depth. I've tried going step by step but I can't seem to figure out which functions are relevant and also things like how to return the range that the A1 values appear in or if using MAX, not having it return values outside of A1's range also.

## Reference Cell Looks At One Range Then See If Any Exist In Another Range

Oct 21, 2009

I have a workbook with two sheets. The first sheet is the data sheet.

Data Worksheet
A B C D colA colA,B colA,B,C colA,B,C,D
104 20 21 CR10600S 104 10420 1042021 1042021DUS
104 20 21 CR10600SX 104 10420 1042021 1042021DUS
104 20 21 CR10603S 104 10420 1042021 1042021DUS
104 20 21 CR10603SX 104 10420 1042021 1042021DUS
104 20 22 CR49605S 104 10420 1042022 1042022HKZ
104 20 22 CR49605SX 104 10420 1042022 1042022HKZ
104 20 23 CR39601P 104 10420 1042023 1042023SPR
The next sheet is where the magic happens. Separate this worksheet into two sections. The reference section (column A and B) and the entry section (column E-G). Column D is a formula that will concatenate column E-G together. In the entry section any number of combinations can be entered. In the reference section I need to take the style number and reference it back to the data sheet. Then take the possible combinations from that style (column E and greater) and see if any of those combinations exist on the other sheet in column D. If so then say added....otherwise say needed.

"....In Pricing Sheet" is where I am looking to put needed or added or something like it.
A B C D E F G
STYLE …IN PRICING SHEET Concat DEPT MCL SCL STYLE
CR10600S Added 1042021 104 20 21
CR10600SX Added 1042022 104 20 22
CR39601P Needed
Any ideas on how to do this in formulas and without code? I have tried and looked into index, match, dget and lookup. I just don't think I am finding the right combination of formulas.

## How To Match A Cell Data With A Range Of Cells And Return Cell Reference In Another Cell

Dec 12, 2012

i want to match a cell data with a range of cells and if matches return the cell reference in another cell

## Getting A Range Reference From A Cell

Jan 16, 2009

i need to copy a range from one workbook ("weekly data") to another ("Yearly data"). The range to copy is called 'weekly data'. The ranges to paste to are called 'week 1' through to 'week 52' (this is the yearly data sheet). On the yearly sheet there is a cell Po1' that week on week will state the week number ie 'week13', 'week14' etc. code to use this data in 'P1' to tell the macro to copy to the appropriate week. I have attached as far as i got (then failed due to lack of experiance).

presuming that both books are open

HTML windows("weekly data").activate
sheets("weekly transfer").select
range("weekly data").copy
windows("yearly data").activate
'only one sheet in workbook
range ' data from p1 .paste

## Use Text In A Cell For A Formula As Cell Reference To Create Range

Mar 10, 2013

I have a list of headings and items and I have a set of formulas that work out depending on the heading what items are listed.

Say theres 10 items and the heading starts at C4 and that heading has 10 items, so it puts "C5" as text in G1 and "C15" as text in G2 so i now know my cell range of items

How can i use the text in those cells to put in a formula to call that as a range?

If I use the indirect formula it shows me the value of the cell, but im after using it to reference the cell

## Dynamic Named Range Sort Including Cells Outside Defined Range

Apr 3, 2008

Im sorting a dynamic range as mentioned in this Sorting a Named Range. My range is called drWarningTypes and is defined as:

=OFFSET(DataSource!\$A\$2,0,0, COUNTA(DataSource!\$A:\$A)-1,1)

When there is only one cell in the range, then running the following sort function includes A1 also in the search (and also adjoining columns).....

## Reference A Cell In Sheet Range

Mar 5, 2008

Im currently located in Sheet1. I want to reference a cell in Sheet2.Range("B2") using a R1C1 reference.

## Cell Address In VBA :: Reference A Range In VBA

Jan 12, 2009

I have a variable which contains the column number. How do I then reference a range in VBA using that column number, as opposed to the letter? I know how to convert the number into the letter, but I also know there has to be something more simpler. For instance, a form of the ADDRESS function, but in VBA?

## Fastest Way To Reference A Cell - Range() Or Cells() ?

Dec 22, 2008

I have a loop that executes roughly 7.7 million times when my VBA program runs. Neednless to say it take a long time to run - usually a couple days.

The inner-most loop contains a line of code from way back in my early vba programming days when I knew even less than the small amount I know about programming now (and if you can follow that sentence you might be able to understand some of the spaghetti code I write :-) ).

for k = 1 to n

if Worksheets("Personell").Range("D" & Trim(Str(k))) > dtCompleted then ...

Would it be faster to use this syntax (which I just found out about):

if Worksheets("Personell").Cells(k,4) > dtCompleted then ...

It would cut out 2 functions calls, trim() and str(), so it would be faster, right?

I am almost embarassed to post the Range("D" & Trim(Str(k)) line of code because it looks so convoluted now, but that's how I learned to program, just fumbling through until it ran...

So in short, I just wanted to confirm that the cells() syntax run faster before I spend an hour editing and tested.

## How To Turn Range.find Into A Cell Reference

Dec 9, 2009

I am writing a function that opens up an external excel document, identifies a string in a certain range and then i also want it to return a cell reference for that string including the number of rows beneath the cell that the string was found in.

## Passing A Value In A Cell To A Named Range Reference

Apr 8, 2008

I have a formula which is using named ranges-

=SUMPRODUCT(xxx-30,Ship_30)/SUM(Ship_30)

where Ship_30 name references the following-
='sheet 1'!\$C\$20:\$C\$38

The value of 20 is static, the value of 38 is dynamic. Each new time period adds another value (i.e. 39,40,41)

Having to edit each name range reference in the name manager is not acceptable since there is potentially over 30 to edit each month.

I would like to edit a cell which would have contained the value 38 (or C38) with a new value of 39 (or C39) so the range reference would be updated with the new value.

The goal would be to have a couple of rows with the following that could be edited with new values

## Convert Named Range To Cell Reference?

Sep 18, 2012

I'm working with a very complex financial workbook with over 3,000 named ranges and would like code to replace the named ranges with the cell references and display it in a message box so the user can easily trace the references without removing the named ranges from the formula. There is a lot of code with the named ranges, so actually converting them to cell references is out of the question.

I found this code, but obviously it physically replaces the range names in the cell. Hopefully it can be converted to display it in a text box.

Code:
Sub FixReferencesToCellNames()
Dim c As Range, n As Name
For Each c In Range("A1:IV65536").SpecialCells(xlCellTypeFormulas)

[Code]....

What I am looking for is that a user select a cell that they want to see the references, run the code to see the cell references for that particular cell in a message box.

## Reference Last Cell In Dynamic Named Range

Nov 14, 2006

In the attached spreadsheet I am trying to always reference the sum column from Qty in Det Est.

This is because the number of roads changes for each project.

I created a dynamic range name surfacing with the following formula:
=offset(qty!\$a\$1,0,0,counta(qty!\$A\$A), counta(qty!\$1\$1)).

My question is what formula do I use to reference the sum column for each row on the Det Est Sheet.