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 22nd, 2002, 12:00 PM   #1
white6174
Board Regular
 
Join Date: May 2002
Location: CALIFORNIA
Posts: 137
Default

Heres what i want to do
I have data in a range A2:A51, sometimes there will be blanks. I need to look up find the first cell with data and put it in B2,then B3 and so on.

any ideas
thanks steve

------A----------B
1---Data--------Filtered lookup
2---------------5
3---------------10
4---------------30
5------5---------2
6-----10---------7
7---------------30
8---------------50
9-----30---------2
10
11-----2
12-----7
13----30
14
15----50
16-----2
17


[ This Message was edited by: white6174 on 2002-05-22 11:10 ]

[ This Message was edited by: white6174 on 2002-05-22 11:13 ]

[ This Message was edited by: white6174 on 2002-05-22 11:13 ]
white6174 is offline   Reply With Quote
Old May 22nd, 2002, 12:54 PM   #2
Jay Petrulis
MrExcel MVP
 
Jay Petrulis's Avatar
 
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
Default

Hi,

Try the following:

Code:
Sub test()
Dim Rng1 As Range, UsedCell As Range

With ActiveSheet
Set Rng1 = .Range("A2:A51")
    For Each UsedCell In Rng1
        If Len(UsedCell) Then
            .Cells(.Cells(Rows.Count, "B").End(xlUp).Row + 1, 2) _
            = UsedCell.Value
        End If
    Next UsedCell
End With

End Sub
Bye,
Jay
Jay Petrulis is offline   Reply With Quote
Old May 22nd, 2002, 01:04 PM   #3
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

As the figure below shows, you could apply Advanced Filter to your data range:

A2 houses the criterion:

=A5<>""

Activate A2.
Activate Data|Filter|Advanced Filter.
Check Copy to another location.
Make sure that the List range contains the range of interest:

$A$4:$A$11

Enter $A$1:$A$2 for Criteria range.
Enter e.g., $C$4 for Copy to.
Leave Unique records only unchecked.
Activate OK.

Microsoft Excel - aaAdvFilter White6174.xls___Running: xl2000 : OS = Windows (32-bit) NT 5.00
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp
A1=

A
B
C
D
1




2
:alert('=A5%3C%3E%22%22')>TRUE


3




4
data
data
5
5
5
6
6
6
7


8
8
8
9
9
9
5
10




11
5


Sheet1

To see the formula in the cells just click on the cells hyperlink

The above image was automatically generated by [HtmlMaker V1.27]
If you want FREE SOFT, click here and Colo will email the file to you
This code was graciously allowed to be modified: by Ivan F Moala All credit to Colo


Note. The original list can also be filtered to a different worksheet in the same workbook.

Aladin Akyurek is offline   Reply With Quote
Old May 22nd, 2002, 02:14 PM   #4
white6174
Board Regular
 
Join Date: May 2002
Location: CALIFORNIA
Posts: 137
Default

Thanks aladin,
but I need this list to updata also like the last one you helped me with last time.

thanks steve w
white6174 is offline   Reply With Quote
Old May 22nd, 2002, 03:46 PM   #5
white6174
Board Regular
 
Join Date: May 2002
Location: CALIFORNIA
Posts: 137
Default

I found an answer thanks for the help though

In case someone else needed the answer

Data is the defined range to be filtered.
(I got this code out of a book EXCEL 2000 POWER PROGRAMING)


{=IF(ISERR(SMALL(IF(Data<>"",ROW(INDIRECT("1:"&ROWS(Data)))),ROW(INDIRECT("1:"&ROWS(Data))))),"",INDEX(Data,SMALL(IF(Data<>"",ROW(INDIRECT("1:"&ROWS(Data)))),ROW(INDIRECT("1:"&ROWS(Data))))))}
white6174 is offline   Reply With Quote
Old May 22nd, 2002, 03:50 PM   #6
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-05-22 14:46, white6174 wrote:
I found an answer thanks for the help though

In case someone else needed the answer

Data is the defined range to be filtered.
(I got this code out of a book EXCEL 2000 POWER PROGRAMING)


{=IF(ISERR(SMALL(IF(Data<>"",ROW(INDIRECT("1:"&ROWS(Data)))),ROW(INDIRECT("1:"&ROWS(Data))))),"",INDEX(Data,SMALL(IF(Data<>"",ROW(INDIRECT("1:"&ROWS(Data)))),ROW(INDIRECT("1:"&ROWS(Data))))))}
This is equivalent to the last step of the procudure I described for your duplicates problem. You just need to skip the initial steps and feed your current number range to the formula in the last step.

Addendum: Here is how.

In A2 in a worksheet named Admin enter: # Recs in Data

In B2 enter:

=MATCH(9.99999999999999E+307,Data!A:A)-(CELL("Row",Data!$A$2)-1)

which assumes that the first numeric entry is in A2 in the worksheet named Data.

Define the following names using Insert|Define|Name.

Name: DataWithBlanks

Refers to: =OFFSET(Data!$A$2,0,0,Admin!$B$2,1)

Name: DataWithNoBlanks

Refers to:

=OFFSET(Data!$C$2,0,0,Admin!$B$2,1)

Activate Data which houses a column range of numbers interspersed with blanks in A from A2 on.

In C2 array-enter and copy down as far as needed:

=IF(ROW()-ROW(DataWithNoBlanks)+1>ROWS(DataWithBlanks)-COUNTBLANK(DataWithBlanks),"",INDIRECT(ADDRESS(SMALL((IF(DataWithBlanks<>"",ROW(DataWithBlanks),ROW()+ROWS(DataWithBlanks))),ROW()-ROW(DataWithNoBlanks)+1),COLUMN(DataWithBlanks))))

In D2 enter:

=IF(ISERR(SMALL(IF(DataWithBlanks<>"",ROW(INDIRECT("1:"&ROWS(DataWithBlanks)))),ROW(INDIRECT("1:"&ROWS(DataWithBlanks))))),"",INDEX(DataWithBlanks,SMALL(IF(DataWithBlanks<>"",ROW(INDIRECT("1:"&ROWS(DataWithBlanks)))),ROW(INDIRECT("1:"&ROWS(DataWithBlanks))))))

Now select a range as big as the data range and hit control+shift+enter. As you can see, you can't just copy down this formula!


See the figure below:

Microsoft Excel - aaEliminateBlanks White6174.xls___Running: xl2000 : OS = Windows (32-bit) NT 5.00
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp
A1=data

A
B
C
D
1
data


2
5
:alert('{=IF(ROW()-ROW(DataWithNoBlanks)+1%3EROWS(DataWithBlanks)-COUNTBLANK(DataWithBlanks),%22%22,INDIRECT(ADDRESS(SMALL((IF(DataWithBlanks%3C%3E%22%22,ROW(DataWithBlanks),ROW()+ROWS(D ataWithBlanks))),ROW()-ROW(DataWithNoBlanks)+1),COLUMN(DataWithBlanks))))}')>5:alert('{=IF(ISERR(SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))),%22%22,INDEX(DataWithBlanks,SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))))}')>5
3
6
:alert('{=IF(ROW()-ROW(DataWithNoBlanks)+1%3EROWS(DataWithBlanks)-COUNTBLANK(DataWithBlanks),%22%22,INDIRECT(ADDRESS(SMALL((IF(DataWithBlanks%3C%3E%22%22,ROW(DataWithBlanks),ROW()+ROWS(D ataWithBlanks))),ROW()-ROW(DataWithNoBlanks)+1),COLUMN(DataWithBlanks))))}')>6:alert('{=IF(ISERR(SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))),%22%22,INDEX(DataWithBlanks,SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))))}')>6
4


:alert('{=IF(ROW()-ROW(DataWithNoBlanks)+1%3EROWS(DataWithBlanks)-COUNTBLANK(DataWithBlanks),%22%22,INDIRECT(ADDRESS(SMALL((IF(DataWithBlanks%3C%3E%22%22,ROW(DataWithBlanks),ROW()+ROWS(D ataWithBlanks))),ROW()-ROW(DataWithNoBlanks)+1),COLUMN(DataWithBlanks))))}')>8:alert('{=IF(ISERR(SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))),%22%22,INDEX(DataWithBlanks,SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))))}')>8
5
8
:alert('{=IF(ROW()-ROW(DataWithNoBlanks)+1%3EROWS(DataWithBlanks)-COUNTBLANK(DataWithBlanks),%22%22,INDIRECT(ADDRESS(SMALL((IF(DataWithBlanks%3C%3E%22%22,ROW(DataWithBlanks),ROW()+ROWS(D ataWithBlanks))),ROW()-ROW(DataWithNoBlanks)+1),COLUMN(DataWithBlanks))))}')>9:alert('{=IF(ISERR(SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))),%22%22,INDEX(DataWithBlanks,SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))))}')>9
6
9
:alert('{=IF(ROW()-ROW(DataWithNoBlanks)+1%3EROWS(DataWithBlanks)-COUNTBLANK(DataWithBlanks),%22%22,INDIRECT(ADDRESS(SMALL((IF(DataWithBlanks%3C%3E%22%22,ROW(DataWithBlanks),ROW()+ROWS(D ataWithBlanks))),ROW()-ROW(DataWithNoBlanks)+1),COLUMN(DataWithBlanks))))}')>5:alert('{=IF(ISERR(SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))),%22%22,INDEX(DataWithBlanks,SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))))}')>5
7


:alert('{=IF(ROW()-ROW(DataWithNoBlanks)+1%3EROWS(DataWithBlanks)-COUNTBLANK(DataWithBlanks),%22%22,INDIRECT(ADDRESS(SMALL((IF(DataWithBlanks%3C%3E%22%22,ROW(DataWithBlanks),ROW()+ROWS(D ataWithBlanks))),ROW()-ROW(DataWithNoBlanks)+1),COLUMN(DataWithBlanks))))}')>0:alert('{=IF(ISERR(SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))),%22%22,INDEX(DataWithBlanks,SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))))}')>0
8
5
:alert('{=IF(ROW()-ROW(DataWithNoBlanks)+1%3EROWS(DataWithBlanks)-COUNTBLANK(DataWithBlanks),%22%22,INDIRECT(ADDRESS(SMALL((IF(DataWithBlanks%3C%3E%22%22,ROW(DataWithBlanks),ROW()+ROWS(D ataWithBlanks))),ROW()-ROW(DataWithNoBlanks)+1),COLUMN(DataWithBlanks))))}')>
:alert('{=IF(ISERR(SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))),%22%22,INDEX(DataWithBlanks,SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))))}')>
9
0
:alert('{=IF(ROW()-ROW(DataWithNoBlanks)+1%3EROWS(DataWithBlanks)-COUNTBLANK(DataWithBlanks),%22%22,INDIRECT(ADDRESS(SMALL((IF(DataWithBlanks%3C%3E%22%22,ROW(DataWithBlanks),ROW()+ROWS(D ataWithBlanks))),ROW()-ROW(DataWithNoBlanks)+1),COLUMN(DataWithBlanks))))}')>
:alert('{=IF(ISERR(SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))),%22%22,INDEX(DataWithBlanks,SMALL(IF(DataWithBlanks%3C%3E%22%22,ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks)))),ROW(INDIRECT(%221:%22&ROWS(DataWithBlanks))))))}')>
Data

To see the formula in the cells just click on the cells hyperlink

The above image was automatically generated by [HtmlMaker V1.27]
If you want FREE SOFT, click here and Colo will email the file to you
This code was graciously allowed to be modified: by Ivan F Moala All credit to Colo



Aladin


[ This Message was edited by: Aladin Akyurek on 2002-05-22 14:51 ]

[ This Message was edited by: Aladin Akyurek on 2002-05-22 15:19 ]
Aladin Akyurek 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 04:19 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