#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default vlookup

I have the following file:

Sheet1

February to
Style # date Revenue ($)
ABB $$
ACD $$
DED $$
DEE $$
CAA $$
FEE $$
FEH $$


Sheet2

March to
date Revenue ($)
ABB $$
DED $$
DEE $$
FEE $$
FEH $$

Each month new styles are added in sheet1. How can I get a formula to look
up a style in sheet1 and if it is new to sheet 2 add it. But only add it if
it has revenue associated with it.

Thanks,
Gingit

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default vlookup

I don't think you're going to find a formula that does this kind of thing.

Maybe you could use a macro that does the work?????

If you want to try:

Option Explicit
Sub testme()

Dim InWks As Worksheet
Dim OutWks As Worksheet
Dim myInRng As Range
Dim myCell As Range
Dim res As Variant
Dim DestCell As Range

Set InWks = Worksheets("sheet1")
Set OutWks = Worksheets("sheet2")

With InWks
Set myInRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In myInRng.Cells
If IsEmpty(myCell.Offset(0, 1).Value) Then
'skip it
Else
If IsNumeric(myCell.Offset(0, 1).Value) Then
'keep looking
res = Application.Match(myCell.Value, OutWks.Range("a:a"), 0)
If IsError(res) Then
'not there, so addit
With OutWks
Set DestCell _
= .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With
DestCell.Value = myCell.Value
DestCell.Offset(0, 1).Value = myCell.Offset(0, 1).Value
End If
End If
End If
Next myCell
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Gingit wrote:

I have the following file:

Sheet1

February to
Style # date Revenue ($)
ABB $$
ACD $$
DED $$
DEE $$
CAA $$
FEE $$
FEH $$

Sheet2

March to
date Revenue ($)
ABB $$
DED $$
DEE $$
FEE $$
FEH $$

Each month new styles are added in sheet1. How can I get a formula to look
up a style in sheet1 and if it is new to sheet 2 add it. But only add it if
it has revenue associated with it.

Thanks,
Gingit


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default vlookup

Thanks Dave I'll give it a try.

Gingit

"Dave Peterson" wrote:

I don't think you're going to find a formula that does this kind of thing.

Maybe you could use a macro that does the work?????

If you want to try:

Option Explicit
Sub testme()

Dim InWks As Worksheet
Dim OutWks As Worksheet
Dim myInRng As Range
Dim myCell As Range
Dim res As Variant
Dim DestCell As Range

Set InWks = Worksheets("sheet1")
Set OutWks = Worksheets("sheet2")

With InWks
Set myInRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In myInRng.Cells
If IsEmpty(myCell.Offset(0, 1).Value) Then
'skip it
Else
If IsNumeric(myCell.Offset(0, 1).Value) Then
'keep looking
res = Application.Match(myCell.Value, OutWks.Range("a:a"), 0)
If IsError(res) Then
'not there, so addit
With OutWks
Set DestCell _
= .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With
DestCell.Value = myCell.Value
DestCell.Offset(0, 1).Value = myCell.Offset(0, 1).Value
End If
End If
End If
Next myCell
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Gingit wrote:

I have the following file:

Sheet1

February to
Style # date Revenue ($)
ABB $$
ACD $$
DED $$
DEE $$
CAA $$
FEE $$
FEH $$

Sheet2

March to
date Revenue ($)
ABB $$
DED $$
DEE $$
FEE $$
FEH $$

Each month new styles are added in sheet1. How can I get a formula to look
up a style in sheet1 and if it is new to sheet 2 add it. But only add it if
it has revenue associated with it.

Thanks,
Gingit


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combine VLOOKUP and IF function so #NA isn't returned as a value from VLOOKUP buffgirl71 Excel Discussion (Misc queries) 12 November 14th 06 11:36 PM
Vlookup -=VLOOKUP(F9,LookUp1!$A$2:$B$1504,2,FALSE) MikeR-Oz New Users to Excel 1 March 22nd 06 09:01 AM
IF(a1="x",(vlookup 18K rows,2,false),(vlookup 18K,3,false)) RAM? bchilt Excel Worksheet Functions 6 January 20th 06 09:21 AM
IF(AND(val1=VLOOKUP( );val2>=VLOOKUP( );val2<=VLOOKUP( );VLOOKUP( Oso Excel Worksheet Functions 2 January 26th 05 06:56 AM
Vlookup info being used without vlookup table attached? Excel Worksheet Functions 0 January 25th 05 10:43 AM


All times are GMT +1. The time now is 09:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"