LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Compare Values in A and Copy to B

Nevermind. I figured out a way to do it. I sorted and grouped by key field
(column A). Then i ran LEN of "B" and posted in Column "C". Then I sorted
by A Ascending / C Descending. Then I ran a macro to separate my keyed
groups by two blank rows. Then, in Column D, I wrote the if statement
=if(A1="",B2,D1). This copied the largest B-field in the keyed array down
through Column D.

The two blank rows caused the if statement to write one too many "B's" and
that extra B was followed by a "0". So I copied the data as values and wrote
another if statement that said if the number one cell to the left and down
one is < 0 then copy the cell to the left. If it is = 0 then enter "0".

Then I did a simple replace "0" down the column, with a blank.

A lot of steps but it worked.

"ConfusedNHouston" wrote:

The title doesn't quite convey what I'm wanting to do but here's an example.

I have data grouped according to a key field in "A" and I have descriptive
data in "B". That descriptive data can actually be parsed into a possible 5
subsets of data. But some "B" fields don't contain all 5 subsets.

For instance PurTexWhoDis15 might mean, Purchased, from Texas, Wholesaler,
Discount of 15%. But some records in my keyed group might only read PurTex.
They should all read PurTexWhoDis15.

I can run a LEN in column "C" and sort by A ascending and then by C
descending and then write an if statement that says if C4 < C3, B3,""). That
works the first time Len is 6 for C4 and Len is 14 for C3. But is the Len of
C5 is 8 also, it just copies the 6-character expression found in B4.

HERE's What I'm getting (and the spaces to separate the key-sorted data are
in the spreadsheet)

KEY CODE PRODUCT
1111 PURTEXWHODIS15 1111-00
1111 PURTEXWHODIS15 1111-14
1111 PURTEX 1111-05
1111 PURTEX 1111-22
1111 PUR 1111-80


2222 PURTEXWHODIS10 2222-01
2222 PURTEXWHO 2222-04
2222 PURTEXWHO 2222-10
2222 PURTEX 2222-15


Here's what I want to end up with:

KEY CODE PRODUCT
1111 PURTEXWHODIS15 1111-00
1111 PURTEXWHODIS15 1111-14
1111 PURTEXWHODIS15 1111-05
1111 PURTEXWHODIS15 1111-22
1111 PURTEXWHODIS15 1111-80


2222 PURTEXWHODIS10 2222-01
2222 PURTEXWHODIS10 2222-04
2222 PURTEXWHODIS10 2222-10
2222 PURTEXWHODIS10 2222-15

Thanks for any help you can offer.



 
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
Compare and Copy CC Excel Discussion (Misc queries) 3 May 29th 08 09:36 PM
compare and copy Arain Excel Discussion (Misc queries) 1 September 18th 06 01:04 PM
Compare values on sheet 1 to values on sheet2 Colin Excel Worksheet Functions 2 August 2nd 06 07:19 PM
Compare and copy unique values sa02000 Excel Worksheet Functions 1 June 12th 06 09:42 PM
Excel Compare values in columns & display missing values in a new cpetta Excel Discussion (Misc queries) 1 April 2nd 05 05:51 AM


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

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

About Us

"It's about Microsoft Excel"