Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default compare cells, copy, loop

I"m working on an inventory sheet which constantly changes in size.
If there is a way to do this with Functions, i would rather that because
this is a report that is run over night when i'm not here. If not, i guess
we can find a way.

I'd like to look down column A and look at every single item.
If there is no duplicate, do nothing
If there are duplicates, it should first find where A and B = each other for
that particular #. Then take all the cooresponding #'s in B and concatenate
them in Column C (each seperated by a colon) on the row where A and B were =.
see below for a visual.

examples
A1 = 364691-001 B1 = 364691-001 C1 = 364692-001:364695-001
A2 = 364691-001 B2 = 364692-001 C2 = (empty cell)
A3 = 364691-001 B3 = 364695-001 C3 = (empty cell)
A4 = A3509A B4 = A3509A C4 = (empty cell)

A1,A2,A3 are duplicates
A1 and B1 are equal to eachother
Take B2 and B3 and concatenate in C1.
C2 and C3 can stay empty
A4 and B4 = eachother, but there are no duplicates so C4 stays empty


I"m not sure if indexing, Vlookup, if, then, next and loop will be needed or
not.
I'm open to any suggestions.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default compare cells, copy, loop

Array enter (enter using Ctrl-Shift-Enter) the formula

=IF(A1<B1,"",IF(COUNTIF($A$1:$A$1000,A1)=2,INDEX (B:B,SMALL(IF($A$1:$A$1000=A1,ROW($A$1:$A$1000)),2 )),"")
& IF(COUNTIF($A$1:$A$1000,A1)=3,":" &INDEX(B:B,SMALL(IF($A$1:$A$1000=A1,ROW($A$1:$A$10 00)),3)),"")
& IF(COUNTIF($A$1:$A$1000,A1)=4,":" &INDEX(B:B,SMALL(IF($A$1:$A$1000=A1,ROW($A$1:$A$10 00)),4)),""))

Add additional terms like this inside the final paren, incrementing the X to the count level that
you need (I hope you can see the pattern)

& IF(COUNTIF($A$1:$A$1000,A1)=X,":" &INDEX(B:B,SMALL(IF($A$1:$A$1000=A1,ROW($A$1:$A$10 00)),X)),"")

And change the 1000s to a high enough number to cover all your data.

HTH,
Bernie
MS Excel MVP


"Immortal_Creations" wrote in message
...
I"m working on an inventory sheet which constantly changes in size.
If there is a way to do this with Functions, i would rather that because
this is a report that is run over night when i'm not here. If not, i guess
we can find a way.

I'd like to look down column A and look at every single item.
If there is no duplicate, do nothing
If there are duplicates, it should first find where A and B = each other for
that particular #. Then take all the cooresponding #'s in B and concatenate
them in Column C (each seperated by a colon) on the row where A and B were =.
see below for a visual.

examples
A1 = 364691-001 B1 = 364691-001 C1 = 364692-001:364695-001
A2 = 364691-001 B2 = 364692-001 C2 = (empty cell)
A3 = 364691-001 B3 = 364695-001 C3 = (empty cell)
A4 = A3509A B4 = A3509A C4 = (empty cell)

A1,A2,A3 are duplicates
A1 and B1 are equal to eachother
Take B2 and B3 and concatenate in C1.
C2 and C3 can stay empty
A4 and B4 = eachother, but there are no duplicates so C4 stays empty


I"m not sure if indexing, Vlookup, if, then, next and loop will be needed or
not.
I'm open to any suggestions.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default compare cells, copy, loop

I should have added "array enter the formula in C1, then copy down to match your list."

Sorry,
Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Array enter (enter using Ctrl-Shift-Enter) the formula

=IF(A1<B1,"",IF(COUNTIF($A$1:$A$1000,A1)=2,INDEX (B:B,SMALL(IF($A$1:$A$1000=A1,ROW($A$1:$A$1000)),2 )),"")
& IF(COUNTIF($A$1:$A$1000,A1)=3,":"
&INDEX(B:B,SMALL(IF($A$1:$A$1000=A1,ROW($A$1:$A$10 00)),3)),"") &
IF(COUNTIF($A$1:$A$1000,A1)=4,":" &INDEX(B:B,SMALL(IF($A$1:$A$1000=A1,ROW($A$1:$A$10 00)),4)),""))

Add additional terms like this inside the final paren, incrementing the X to the count level that
you need (I hope you can see the pattern)

& IF(COUNTIF($A$1:$A$1000,A1)=X,":"
&INDEX(B:B,SMALL(IF($A$1:$A$1000=A1,ROW($A$1:$A$10 00)),X)),"")

And change the 1000s to a high enough number to cover all your data.

HTH,
Bernie
MS Excel MVP


"Immortal_Creations" wrote in message
...
I"m working on an inventory sheet which constantly changes in size.
If there is a way to do this with Functions, i would rather that because
this is a report that is run over night when i'm not here. If not, i guess
we can find a way.

I'd like to look down column A and look at every single item.
If there is no duplicate, do nothing
If there are duplicates, it should first find where A and B = each other for
that particular #. Then take all the cooresponding #'s in B and concatenate
them in Column C (each seperated by a colon) on the row where A and B were =.
see below for a visual.

examples
A1 = 364691-001 B1 = 364691-001 C1 = 364692-001:364695-001
A2 = 364691-001 B2 = 364692-001 C2 = (empty cell)
A3 = 364691-001 B3 = 364695-001 C3 = (empty cell)
A4 = A3509A B4 = A3509A C4 = (empty cell)

A1,A2,A3 are duplicates
A1 and B1 are equal to eachother
Take B2 and B3 and concatenate in C1.
C2 and C3 can stay empty
A4 and B4 = eachother, but there are no duplicates so C4 stays empty


I"m not sure if indexing, Vlookup, if, then, next and loop will be needed or
not.
I'm open to any suggestions.





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
compare 2 cells then copy value if they are different Gwen B Excel Discussion (Misc queries) 3 May 15th 09 05:44 PM
VBA Loop to Find then Copy & Paste B J Hankinson Excel Discussion (Misc queries) 0 April 15th 09 06:39 PM
Loop thru rows to copy to another excel spreadsheet eighthman11 Excel Worksheet Functions 0 October 9th 06 09:21 PM
copy,paste and loop through workbook TUNGANA KURMA RAJU Excel Discussion (Misc queries) 0 December 6th 05 12:31 PM
Find and Copy loop problem BillyJ Excel Discussion (Misc queries) 3 November 2nd 05 07:16 PM


All times are GMT +1. The time now is 06:38 AM.

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"