Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 07-01-2009, 03:33 PM
Islandic Islandic is offline
Registered User
 
Join Date: 15 Jun 2009
Location: Oslo, Norway
MS Office Version:Excel 2003
Posts: 5
Islandic is becoming part of the community
Question How to combine two columns with certain conditions?

Please Register to Remove these Ads

Hi all,

I have a small but delicate problem, that I want to solve without using VBA. I have two pairs of data. The first pair consists of the "price" and "NR of sales" of items X and the second pair consists of the "price" and "NR in stock"of items X. The colums try to predict the number in stock and sales at at a certain market price.

Now what I want to do is to merge both pairs into one pair of data with three columns, and apply the following conditions.
-for every price there must be a "NR of sales" & "NR in stock"
-when one of the other data sets does not have a price that the other pair has, then for "NR of Sales" it needs to fill in a "NR of sales" number from pair 1 with a price higher than the price in the new merged columns. For a "NR in stock" value this should be a lower number.

The example should make this clear:

Pair 1:

Price;NR of Sales
$18.00;50000
$19.00;45000
$20.00;37000
$24.00;32000
$28.00;26000
$32.00;25000

Price;NR in Stock
$31.00;45000
$29.00;36000
$28.00;28000
$27.00;22000
$24.00;16000
$19.00;12000
$10.00;5000

Now I want to merge these two pairs, and the merged pair should look like the following:
PRICE;NR of SALES; NR in Stock
$10.00;50000;5000
$18.00;50000;5000
$19.00;45000;12000
$20.00;37000;16000
$24.00;32000;16000
$27.00;26000;22000
$28.00;26000;28000
$29.00;25000;36000
$31.00;25000;45000
$32.00;25000;45000

I also attached a spreadsheet for your convenience,

Thanks!
Attached Files
File Type: xls Example-.xls (19.0 KB, 5 views)
Reply With Quote
  #2  
Old 07-01-2009, 10:42 PM
ManyQuestions ManyQuestions is offline
Registered User
 
Join Date: 25 Apr 2009
Location: Mo.
MS Office Version:Excel 2003
Posts: 7
ManyQuestions is becoming part of the community
Re: How to combine two columns with certain conditions?

Takes a while to type but is Very fast and simple if you read my way of compairing. You can easily do this in many columns if I follow your questions correctly.

First click a blank cell in a blank column, now hit the field plus on the 10 key, now click one of the cells with the information in it that you need such as the price, now hit minus on the 10 key or asteric or / for multiply or devide or plus key located next to the backspace key to add, next click the cell you want to compair price with and hit enter. once done you should have the difference in price minus price or price devided by price in the first blank cell you clicked in. Now click on that cell and copy, then black out the whole column there and click paste, excel compairs them all for you at once.
Reply With Quote
  #3  
Old 07-02-2009, 12:02 AM
JBeaucaire's Avatar
JBeaucaire JBeaucaire is offline
Forum Guru
 
Join Date: 21 Mar 2008
Location: Bakersfield, CA
MS Office Version:2003 (can read 2007 files)
Posts: 9,532
JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay
Send a message via Skype™ to JBeaucaire
Re: How to combine two columns with certain conditions?

Ok, your tables needed the missing ZERO values, and they needed to both be in ascending order, and with that, simple worksheet functions do the rest. Index/Match...

Have a look.
Attached Files
File Type: xls Example-.xls (18.0 KB, 8 views)
__________________
If you've been given good help, use the icon to give reputation feedback, it is appreciated.
Always put your code between [code] and [/code] tags.
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Reply With Quote
  #4  
Old 07-02-2009, 04:09 AM
Islandic Islandic is offline
Registered User
 
Join Date: 15 Jun 2009
Location: Oslo, Norway
MS Office Version:Excel 2003
Posts: 5
Islandic is becoming part of the community
Question Re: How to combine two columns with certain conditions?

Excellent that seems to work. Now I also need the price column in the Pairs
Merged automated, grabbing its data from the price range in PAIR 1 and Pair 2, any idea how to do this.

I tried to copy and sorted the data ascending, but I get double prices (e.g. $19.00) that do not belong there, and only need to be single.

Thanks
Reply With Quote
  #5  
Old 07-02-2009, 09:05 AM
JBeaucaire's Avatar
JBeaucaire JBeaucaire is offline
Forum Guru
 
Join Date: 21 Mar 2008
Location: Bakersfield, CA
MS Office Version:2003 (can read 2007 files)
Posts: 9,532
JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay
Send a message via Skype™ to JBeaucaire
Re: How to combine two columns with certain conditions?

Please post your new needs / issues in a viewable document so my weak old brain can fathom it more clearly. Thanks.
__________________
If you've been given good help, use the icon to give reputation feedback, it is appreciated.
Always put your code between [code] and [/code] tags.
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump