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 21st, 2002, 01:48 AM   #1
BenNV
Board Regular
 
Join Date: Mar 2002
Posts: 160
Default

Hiya all, I'm looking to do the following. I have a worksheet that looks like:

Name TodayDate Value
ABC 21/05/02 102
GUY 21/05/02 121
DIR 21/05/02 878

I have another worksheet in that workbook that has ABC, GUY, DIR in row 3, so:

Date DIR ABC GUY
18/05/02 154 545 454
19/05/02 455 124 432
20/05/02 178 566 335
21/05/02

I want some code whereby it will go through the initial list and find the match for column name (eg: ABC = ABC) and then find today's date (i.e. in the Date column of the second worksheet) and paste the data. So, in the second worksheet for today's date, you would see:

Date DIR ABC GUY
18/05/02 154 545 454
19/05/02 455 124 432
20/05/02 178 566 335
21/05/02 878 102 121

I don't think I can use VLOOKUP as the initial worksheet is updated everyday with new info and the second worksheet retains it's data.

Thks u...Benjy
BenNV is offline   Reply With Quote
Old May 21st, 2002, 04:05 AM   #2
BenNV
Board Regular
 
Join Date: Mar 2002
Posts: 160
Default

This is what I have so far:

Sub bobLook()

Dim todaysDate As Long
Dim Keep_This As String

ee = 1
ss = 2
ff = 1

todaysDate = CLng(Int(Now()))

Keep_This = Worksheets("Ben").Cells(ee, 1).Value

While (Worksheets("Ben").Cells(ee, 1).Value <> "")
While (Worksheets("Day").Cells(3, ss).Value <> "")
If (Worksheets("Day").Cells(3, ss).Value = Keep_This) Then
While (Worksheets("Day").Cells(ff, 1).Value <> "")
If CLng(Worksheets("Day").Cells(ff, 1).Value = todaysDate) Then
'Having trouble here
ee = ee + 1
Keep_This = Worksheets("Ben").Cells(ee, 1).Value
cc = 2
Else
cc = cc + 1
End If
Wend
Wend

End Sub

BenNV is offline   Reply With Quote
Old May 21st, 2002, 04:25 AM   #3
Ian Mac
MrExcel MVP
 
Join Date: Feb 2002
Location: Newcastle, UK
Posts: 1,174
Default

Quote:
On 2002-05-21 00:48, BenNV wrote:
Hiya all, I'm looking to do the following. I have a worksheet that looks like:

Name TodayDate Value
ABC 21/05/02 102
GUY 21/05/02 121
DIR 21/05/02 878

I have another worksheet in that workbook that has ABC, GUY, DIR in row 3, so:

Date DIR ABC GUY
18/05/02 154 545 454
19/05/02 455 124 432
20/05/02 178 566 335
21/05/02

I want some code whereby it will go through the initial list and find the match for column name (eg: ABC = ABC) and then find today's date (i.e. in the Date column of the second worksheet) and paste the data. So, in the second worksheet for today's date, you would see:

Date DIR ABC GUY
18/05/02 154 545 454
19/05/02 455 124 432
20/05/02 178 566 335
21/05/02 878 102 121

I don't think I can use VLOOKUP as the initial worksheet is updated everyday with new info and the second worksheet retains it's data.

Thks u...Benjy
A formula based approach.

if you have a sheet2 with following info:

Microsoft Excel - Ian.xls___Running: xl97 : OS = Windows (32-bit) NT 4.00
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp
C20=

A
B
C
D
1
NameTodayDateValue
2
ABC18/05/02102
3
GUY18/05/02121
4
DIR18/05/02878
5
ABC19/05/021143
6
GUY19/05/021531
7
DIR19/05/021919
8
ABC20/05/022307
9
GUY20/05/022695
10
DIR20/05/023083
11
ABC21/05/023471
12
GUY21/05/023859
13
DIR21/05/024247
Sheet2

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


Goto Insert>Names>Define

Type NameField in the first box
in the Refers To: type:

=OFFSET(Sheet2!$A$1,0,0,COUNTA(Sheet2!$A:$A),1)

click Add

do the same for DateField and ValueField changing the Sheet2!$A$1 to Sheet2!$B$1/Sheet2!$C$1 respectively.

now on sheet1 use:

Microsoft Excel - Ian.xls___Running: xl97 : OS = Windows (32-bit) NT 4.00
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp
A3=Date

A
B
C
D
3
DateDIRABCGUY
4
18/05/02:alert('=SUMPRODUCT((NameField=B$3)*(DateField=$A4),ValueField)')>878:alert('=SUMPRODUCT((Sheet2!$A$1:$A$13=C$3)*(Sheet2!$B$1:$B$13=$A4),Sheet2!$C$1:$C$13)')>102:alert('=SUMPRODUCT((Sheet2!$A$1:$A$13=D$3)*(Sheet2!$B$1:$B$13=$A4),Sheet2!$C$1:$C$13)')>121
5
19/05/02:alert('=SUMPRODUCT((Sheet2!$A$1:$A$13=B$3)*(Sheet2!$B$1:$B$13=$A5),Sheet2!$C$1:$C$13)')>1919:alert('=SUMPRODUCT((Sheet2!$A$1:$A$13=C$3)*(Sheet2!$B$1:$B$13=$A5),Sheet2!$C$1:$C$13)')>1143:alert('=SUMPRODUCT((Sheet2!$A$1:$A$13=D$3)*(Sheet2!$B$1:$B$13=$A5),Sheet2!$C$1:$C$13)')>1531
6
20/05/02:alert('=SUMPRODUCT((Sheet2!$A$1:$A$13=B$3)*(Sheet2!$B$1:$B$13=$A6),Sheet2!$C$1:$C$13)')>3083:alert('=SUMPRODUCT((Sheet2!$A$1:$A$13=C$3)*(Sheet2!$B$1:$B$13=$A6),Sheet2!$C$1:$C$13)')>2307:alert('=SUMPRODUCT((Sheet2!$A$1:$A$13=D$3)*(Sheet2!$B$1:$B$13=$A6),Sheet2!$C$1:$C$13)')>2695
7
21/05/02:alert('=SUMPRODUCT((Sheet2!$A$1:$A$13=B$3)*(Sheet2!$B$1:$B$13=$A7),Sheet2!$C$1:$C$13)')>4247:alert('=SUMPRODUCT((Sheet2!$A$1:$A$13=C$3)*(Sheet2!$B$1:$B$13=$A7),Sheet2!$C$1:$C$13)')>3471:alert('=SUMPRODUCT((Sheet2!$A$1:$A$13=D$3)*(Sheet2!$B$1:$B$13=$A7),Sheet2!$C$1:$C$13)')>3859
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


Click the Underlined Numbers for the formulas.

Hope this helps

_________________
Share the wealth!!
Ian Mac

[ This Message was edited by: Ian Mac on 2002-05-21 03:26 ]
Ian Mac 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 09:55 AM.


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