Which function should I use? Please advise

excellearner1298

New Member
Joined
Aug 19, 2013
Messages
5
Hello, I am relatively new to the repertoire of functions in Excel and need your suggestions. Anything will help! I need to build this set as soon as possible.



Project: Building a dataset based on US Imports. Every product has a unique identifyer (product code).

If a product qualifies for several programs, the original data set repeats the product code along with every program. The data looks something like this:

code 1 program "a" amount$
code 1 program "b" amount$
code 2 program "a" amount$
code 2 program "c" amount$
code 3 program "a" amount$

I need a column with a variable/ code that will let me know which entry program each product used. I want a dataset that looks like this:

code 1 program "a and b" amount$
code 2 program "a and c" amount$
code 3 program "a" amount$

or something like this

code 1 2 amount$
code 2 3 amount$
code 3 1 amount$

where 1=program a, 2= program a and b, and 3= program a and c


I was considering Vlookup but don't think this will work because one code is repeated several times. The other function I was thinking about was Concatenate- "concatenate the column that lists the program name if the code is repeated" and "sum if the code is repeated".



Thank you for your help!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Difficult to understand your requirements, if you could include a screenshot with actual examples it would help alot, e.g. column and row details, actual data content etc.

If you're using Excel 2007 or later, the SUMIFs function is likely to return what you want.

SUMPRODUCT probably can too and would suggest using that if you're on Excel 2003 or earlier.
 
Upvote 0
Hello and thank you for your answer.

Here is an example of format the data is in right now

[TABLE="width: 500"]
<tbody>[TR]
[TD]code [/TD]
[TD]program code [/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 98"]
<tbody>[TR]
[TD="class: xl66, width: 98"]03023400[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 144"]
<tbody>[TR]
[TD]No program claimed[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 98"]
<tbody>[TR]
[TD="class: xl66, width: 98"]03033901[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 144"]
<tbody>[TR]
[TD][TABLE="width: 144"]
<tbody>[TR]
[TD]Andean Act (ATPA) [/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 98"]
<tbody>[TR]
[TD="class: xl66, width: 98"]03033901[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]GSP[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 98"]
<tbody>[TR]
[TD="class: xl66, width: 98"]07108070[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 144"]
<tbody>[TR]
[TD]Andean Act (ATPA) [/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 98"]
<tbody>[TR]
[TD="class: xl66, width: 98"]07108070[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]GSP[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 98"]
<tbody>[TR]
[TD="class: xl66, width: 98"]07102120[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]GSP[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


This is what I want

[TABLE="width: 500"]
<tbody>[TR]
[TD]code [/TD]
[TD]program code [/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 98"]
<tbody>[TR]
[TD="class: xl66, width: 98"]03023400[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 144"]
<tbody>[TR]
[TD]No program claimed[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 98"]
<tbody>[TR]
[TD="class: xl66, width: 98"]03033901[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 144"]
<tbody>[TR]
[TD][TABLE="width: 144"]
<tbody>[TR]
[TD]Andean Act (ATPA) & GSP[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 98"]
<tbody>[TR]
[TD="class: xl66, width: 98"]07108070[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 144"]
<tbody>[TR]
[TD]Andean Act (ATPA) & GSP[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 98"]
<tbody>[TR]
[TD="class: xl66, width: 98"]07102120[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]GSP[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Once I have this set up I will use v look up get the amount from another set. I am sorry if the last idea in my post was confusing. I meant to convey that I don't need the programs to be spelled out, I mentioned this because working with string text might present difficulties. If it is easier to work with a code, as opposed to the program name, I have no problem doing that.

thank you very much for your advice
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top