Author Topic: Excel help  (Read 733 times)

never_retreat

  • Head Muckety Muck
  • friend
  • Senior Member
  • ***
  • Posts: 3,158
Excel help
« on: June 11, 2013, 04:16:49 PM »
Any excel wizards in the hose.
I need to update some pricing at work. Here is the situation.
I have a sheet with the existing data. part number, cost, retail.
I have another sheet with the new data. part number, cost, retail, and Upc. The part number is the unique identifier the other 3 need to overwrite the old data.
How do I do this? Oh and the new sheet may have part numbers that are not in my data base, and my data might contain some part numbers that are not on the new sheet.
I needed a mod to change my signature because the concept of "family friendly" eludes me.
Just noticed that a mod changed my signature. How long ago was that?
A few months-mods

drewtam

  • friend
  • Senior Member
  • ***
  • Posts: 1,985
Re: Excel help
« Reply #1 on: June 11, 2013, 04:34:57 PM »
Quick way would be to use either a "vlookup" or "match" function to find the match and output the new data.

=vlookup(look up value -> old part number, table array -> the new data set, column of data to output)

If it can't find a match, it will output an error. You could nest the vlookup inside an "if" statement, so that an error from vlookup outputs the old data set.

Do you need to import the new part numbers into the old sheet too?
I’m not saying I invented the turtleneck. But I was the first person to realize its potential as a tactical garment. The tactical turtleneck! The… tactleneck!

never_retreat

  • Head Muckety Muck
  • friend
  • Senior Member
  • ***
  • Posts: 3,158
Re: Excel help
« Reply #2 on: June 11, 2013, 04:42:17 PM »
Quick way would be to use either a "vlookup" or "match" function to find the match and output the new data.

=vlookup(look up value -> old part number, table array -> the new data set, column of data to output)

If it can't find a match, it will output an error. You could nest the vlookup inside an "if" statement, so that an error from vlookup outputs the old data set.

Do you need to import the new part numbers into the old sheet too?

I could not figure out the vlookup. No I don't need the new part numbers added. But I do need the new column with the upc codes associated with the old part number.

So should I put all this data onto the same sheet?
I needed a mod to change my signature because the concept of "family friendly" eludes me.
Just noticed that a mod changed my signature. How long ago was that?
A few months-mods

never_retreat

  • Head Muckety Muck
  • friend
  • Senior Member
  • ***
  • Posts: 3,158
Re: Excel help
« Reply #3 on: June 11, 2013, 04:46:38 PM »
How would the fourmula look if my sheet looked like this.

a1 Existing part number, b1 cost, c1 retail, d1 new part number, e1 new cost, f1 new retail, g1 upc

I needed a mod to change my signature because the concept of "family friendly" eludes me.
Just noticed that a mod changed my signature. How long ago was that?
A few months-mods

Tallpine

  • friends
  • Senior Member
  • ***
  • Posts: 23,172
  • Grumpy Old Grandpa
Re: Excel help
« Reply #4 on: June 11, 2013, 04:58:00 PM »
How big are the data sets?  If not too big, you could copypaste the new data below the old data*, change the text color of the new data, and then sort the whole thing by part number and manually delete duplicate old part numbers  =|

* or add a new column: "Old" or "New"


Otherwise, if it was me I would just export both files to delimited text, write a C routine to merge them, and then import the result back into excel  =D
Freedom is a heavy load, a great and strange burden for the spirit to undertake. It is not easy. It is not a gift given, but a choice made, and the choice may be a hard one. The road goes upward toward the light; but the laden traveller may never reach the end of it.  - Ursula Le Guin

drewtam

  • friend
  • Senior Member
  • ***
  • Posts: 1,985
Re: Excel help
« Reply #5 on: June 11, 2013, 05:05:49 PM »
Put each of these results in a separate column, where ever you like.

I went to g100, if your parts list is longer, then use whatever row it stops at.

The "$" symbol allows you to fill down the formula easier. As it fills down, the a1 inside the function will automatically be changed to a2, to a3, etc. But the "$" will prevent the table reference cells from changing.
http://spreadsheets.about.com/od/excel2010/ss/2011-05-23-excel-2010-fill-down-fill-handle.htm

Row 1
this will pull in the new cost
h1
=vlookup(a1,$d$1:$g$100,2)

this will pull in the new retail
i1
=vlookup(a1,$d$1:$g$100,3)

this will pull in the new upc
j1
=vlookup(a1,$d$1:$g$100,4)


Row 2
new cost
h2
=vlookup(a2,$d$1:$g$100,2)

new retail
i2
=vlookup(a2,$d$1:$g$100,3)

new upc
j2
=vlookup(a2,$d$1:$g$100,4)
« Last Edit: June 11, 2013, 05:10:16 PM by drewtam »
I’m not saying I invented the turtleneck. But I was the first person to realize its potential as a tactical garment. The tactical turtleneck! The… tactleneck!

never_retreat

  • Head Muckety Muck
  • friend
  • Senior Member
  • ***
  • Posts: 3,158
Re: Excel help
« Reply #6 on: June 12, 2013, 12:25:04 AM »
How big are the data sets?  If not too big, you could copypaste the new data below the old data*, change the text color of the new data, and then sort the whole thing by part number and manually delete duplicate old part numbers  =|

* or add a new column: "Old" or "New"


Otherwise, if it was me I would just export both files to delimited text, write a C routine to merge them, and then import the result back into excel  =D
Big 2-3000 lines.

Thanks drewtam I will try yours out tomorrow.
I needed a mod to change my signature because the concept of "family friendly" eludes me.
Just noticed that a mod changed my signature. How long ago was that?
A few months-mods

never_retreat

  • Head Muckety Muck
  • friend
  • Senior Member
  • ***
  • Posts: 3,158
Re: Excel help
« Reply #7 on: June 12, 2013, 09:41:17 PM »
Put each of these results in a separate column, where ever you like.

I went to g100, if your parts list is longer, then use whatever row it stops at.

The "$" symbol allows you to fill down the formula easier. As it fills down, the a1 inside the function will automatically be changed to a2, to a3, etc. But the "$" will prevent the table reference cells from changing.
http://spreadsheets.about.com/od/excel2010/ss/2011-05-23-excel-2010-fill-down-fill-handle.htm

Row 1
this will pull in the new cost
h1
=vlookup(a1,$d$1:$g$100,2)

this will pull in the new retail
i1
=vlookup(a1,$d$1:$g$100,3)

this will pull in the new upc
j1
=vlookup(a1,$d$1:$g$100,4)


Row 2
new cost
h2
=vlookup(a2,$d$1:$g$100,2)

new retail
i2
=vlookup(a2,$d$1:$g$100,3)

new upc
j2
=vlookup(a2,$d$1:$g$100,4)

I think this is working, I was playing around with it and it working. I had to add a false to the end because it was trying to find some stuff.
I just screwed it up because of some rounding that took place on some un formated columns.
I needed a mod to change my signature because the concept of "family friendly" eludes me.
Just noticed that a mod changed my signature. How long ago was that?
A few months-mods

drewtam

  • friend
  • Senior Member
  • ***
  • Posts: 1,985
Re: Excel help
« Reply #8 on: June 12, 2013, 10:10:32 PM »
I think this is working, I was playing around with it and it working. I had to add a false to the end because it was trying to find some stuff.
I just screwed it up because of some rounding that took place on some un formated columns.


Oh yeah, I forgot that it sometimes finds the first answer it thinks is close when the it is not in order. Adding the final option of 'false' should make it find the exact match.
I’m not saying I invented the turtleneck. But I was the first person to realize its potential as a tactical garment. The tactical turtleneck! The… tactleneck!

never_retreat

  • Head Muckety Muck
  • friend
  • Senior Member
  • ***
  • Posts: 3,158
Re: Excel help
« Reply #9 on: June 12, 2013, 11:27:03 PM »
Oh yeah, I forgot that it sometimes finds the first answer it thinks is close when the it is not in order. Adding the final option of 'false' should make it find the exact match.
Most the part numbers have a sequence.
A812-44-m
A812-44-L
A812-44-xl

stuff like that.
I needed a mod to change my signature because the concept of "family friendly" eludes me.
Just noticed that a mod changed my signature. How long ago was that?
A few months-mods