MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 2nd, 2002, 02:03 AM   #1
Nobby
Board Regular
 
Join Date: Feb 2002
Location: United Kingdom
Posts: 68
Default

I have named a range "MainDataTable" and this refers to a table of data that currently runs from A6 - L28.

I have defined the range as follows:

=OFFSET('Main Data Table'!$A$6:$L$28,0,0,COUNTA('Main Data Table'!$A:$L),1)

However, when I use Edit/GoTo, it just selects Col A, whereas it should select the whole range A:L

Any ideas where I am going wrong in my OFFSET function?

Cheers

Nobby
Nobby is offline   Reply With Quote
Old May 2nd, 2002, 02:30 AM   #2
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,318
Default

Quote:
On 2002-05-02 01:03, Nobby wrote:
I have named a range "MainDataTable" and this refers to a table of data that currently runs from A6 - L28.

I have defined the range as follows:

=OFFSET('Main Data Table'!$A$6:$L$28,0,0,COUNTA('Main Data Table'!$A:$L),1)

However, when I use Edit/GoTo, it just selects Col A, whereas it should select the whole range A:L

Any ideas where I am going wrong in my OFFSET function?

Cheers

Nobby
Which column in A to L is of numeric type? Is that a column that also reflect the changes to the data area between A and L?


Aladin Akyurek is offline   Reply With Quote
Old May 2nd, 2002, 02:38 AM   #3
Nobby
Board Regular
 
Join Date: Feb 2002
Location: United Kingdom
Posts: 68
Default

The table records details of customer complaints, and the columns include customer name, account number, staff member dealing, nature of complaint by code etc. So whilst some of the data may be numerical, none of it is calculated.

Effectively, each new complaint will fill a complete row from A?;L?

The analysis of the table is done in pivot tables, which is why I need to be able to point directly to the dynamic range of Main Data.

Nobby
Nobby is offline   Reply With Quote
Old May 2nd, 2002, 02:51 AM   #4
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,318
Default

Quote:
On 2002-05-02 01:38, Nobby wrote:
The table records details of customer complaints, and the columns include customer name, account number, staff member dealing, nature of complaint by code etc. So whilst some of the data may be numerical, none of it is calculated.

Effectively, each new complaint will fill a complete row from A?;L?

The analysis of the table is done in pivot tables, which is why I need to be able to point directly to the dynamic range of Main Data.

Nobby
Nobby,

Please try to be precise. In exchange, I'll tell you what is wrong with the formula that you used .

So, Are the account numbers true numbers? Are they in column B? If not, Do you have a date column, and if yes, which one is it?

Aladin
Aladin Akyurek is offline   Reply With Quote
Old May 2nd, 2002, 03:29 AM   #5
Nobby
Board Regular
 
Join Date: Feb 2002
Location: United Kingdom
Posts: 68
Default

Col A - Custom Format - mmm - Month date entered here
Col B - Custom Format - ddd-mmm-yyyy - the column is blank at the moment and will now be deleted from the sheet.
Col C contains the account number, which is a mixture of letters and numbers e.g S342ABC. This is formatted as General.
All other columns contain text and are formatted as General.

Does this help?

Nobby
Nobby is offline   Reply With Quote
Old May 2nd, 2002, 04:10 AM   #6
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,318
Default

Quote:
On 2002-05-02 02:29, Nobby wrote:
Col A - Custom Format - mmm - Month date entered here
Col B - Custom Format - ddd-mmm-yyyy - the column is blank at the moment and will now be deleted from the sheet.
Col C contains the account number, which is a mixture of letters and numbers e.g S342ABC. This is formatted as General.
All other columns contain text and are formatted as General.

Does this help?

Nobby
OK.

I'll assume that the labels like Account Number, etc. are in row 6 and the real data start at row 7.

Activate Insert|Name|Define.
Enter Nrecs as name in the Names in Workbook box.
Enter as formula in the Refers to box:

1) if column A is numeric, which means that =ISNUMBER(any-cell-in-A) returns TRUE,

=MATCH(9.99999999999999E+307,'Main Data Table'!$A:$A)

2) if column A is not numeric,

=MATCH(REPT("z",40),'Main Data Table'!$C:$C)

Note. It must be either (1) or (2).

Activate Add. (Don't leave yet the Define Name window.)

Enter PivotRecs as name in the Names in Workbook box.
Enter as formula in the Refers to box:

=Nrecs-(ROW('Main Data Table'!$A$6)-1)

I expressly called this one PivotRecs, because Pivot Tables must have a range which includes the row with the labels, that is, Pivot Tables needs to know the labels heading the data.

Activate Add. (Don't leave yet the Define Name window.)

Enter MainDataTable as name (a name that you already have) in the Names in Workbook box.
Enter as formula in the Refers to box:

=OFFSET('Main Data Table'!$A$6,0,0,PivotRecs,11)

Since you're going to delete column B from the current data area, the area will now cover A thru K. That's 11 columns, whence 11 in the formula. This number can also be computed dynamically if the sheet Main Data Table doesn't contain anything but the data you want to feed to the PivotTables. Anyway, if you change the number of consecutive columns, you'll need to adjust this number.

Activate OK.

You're done.

Back to the original formula, as I promised:

COUNTA is risky, because it's unable to count blanks which leads to an incorrect range.

It did not include every column: it uses 1 at the end.

It will not be able to include any row of data beyond row 28.

Aladin
Aladin Akyurek is offline   Reply With Quote
Old May 2nd, 2002, 08:14 AM   #7
Drew
Board Regular
 
Join Date: Feb 2002
Location: Boston, Mass
Posts: 169
Default

Aladin,
I'm probably missing something here but why define PivotRecs?

Could it be done in just two steps?
=MATCH(REPT("z",40),'Main Data Table'!$C:$C)-1 (named Nrecs)
=OFFSET('Main Data Table'!$A$6,0,0,Nrecs,11)
The offset is anchored on the label $A$6.

Just Curious.
Thanks,
Drew
Drew is offline   Reply With Quote
Old May 2nd, 2002, 08:32 AM   #8
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,318
Default

Quote:
On 2002-05-02 07:14, Drew wrote:
Aladin,
I'm probably missing something here but why define PivotRecs?

Could it be done in just two steps?
=MATCH(REPT("z",40),'Main Data Table'!$C:$C)-1 (named Nrecs)
=OFFSET('Main Data Table'!$A$6,0,0,Nrecs,11)
The offset is anchored on the label $A$6.

Just Curious.
Thanks,
Drew
Drew,

That's a good question. You can find the answer by inserting new rows before the row where the data start. Type in a empty cell

=MainDataTable

Activate this cell, go to the Formula Bar, select the formula, hit F9. You'll see a constant array whose last few members are all zeroes indicating extraneous bits of data that does not belong to the MainDataTable.

Aladin

[ This Message was edited by: Aladin Akyurek on 2002-05-02 07:32 ]
Aladin Akyurek is offline   Reply With Quote
Old May 2nd, 2002, 09:06 AM   #9
Drew
Board Regular
 
Join Date: Feb 2002
Location: Boston, Mass
Posts: 169
Default

Aladin,
I see. Makes sense now. Great way to keep it truely dynamic.
Thanks for the explanation.
Drew
Drew is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:18 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes