Rept numbers & names by using VBA/excel funtion

harinsh

Active Member
Joined
Feb 7, 2012
Messages
273
Hi All,

I'm looking for one function/vba code which needs to repeat the required cell value based on the given condition.

Example:
Manual Data:

[TABLE="width: 192"]
<colgroup><col style="width:48pt" span="3" width="64"> </colgroup><tbody>[TR]
[TD="class: xl64, width: 64"]Number[/TD]
[TD="class: xl64, width: 64"]8[/TD]
[TD="class: xl64, width: 64"] [/TD]
[/TR]
[TR]
[TD="class: xl65"]Names[/TD]
[TD="class: xl65"]%[/TD]
[TD="class: xl65"]Rept No[/TD]
[/TR]
[TR]
[TD="class: xl64"]A[/TD]
[TD="class: xl66"]40%[/TD]
[TD="class: xl64"]4
[/TD]
[/TR]
[TR]
[TD="class: xl64"]B[/TD]
[TD="class: xl66"]30%[/TD]
[TD="class: xl64"]3[/TD]
[/TR]
[TR]
[TD="class: xl64"]C[/TD]
[TD="class: xl66"]20%[/TD]
[TD="class: xl64"]1[/TD]
[/TR]
</tbody>[/TABLE]

Required Output:
[TABLE="width: 128"]
<colgroup><col style="width:48pt" span="2" width="64"> </colgroup><tbody>[TR]
[TD="class: xl66, width: 64"]Numbers
[/TD]
[TD="class: xl66, width: 64"]Names
[/TD]
[/TR]
[TR]
[TD="class: xl66"]1
[/TD]
[TD="class: xl66"]A
[/TD]
[/TR]
[TR]
[TD="class: xl66"]2
[/TD]
[TD="class: xl66"]A[/TD]
[/TR]
[TR]
[TD="class: xl66"]3
[/TD]
[TD="class: xl66"]A[/TD]
[/TR]
[TR]
[TD="class: xl66"]4
[/TD]
[TD="class: xl66"]A[/TD]
[/TR]
[TR]
[TD="class: xl66"]5
[/TD]
[TD="class: xl66"]B[/TD]
[/TR]
[TR]
[TD="class: xl66"]6
[/TD]
[TD="class: xl66"]B[/TD]
[/TR]
[TR]
[TD="class: xl66"]7
[/TD]
[TD="class: xl66"]B[/TD]
[/TR]
[TR]
[TD="class: xl66"]8
[/TD]
[TD="class: xl66"]C[/TD]
[/TR]
</tbody>[/TABLE]

In the given example you can see the % should enter by the user based on number 8 which is input value by the user.

You can also find the corresponding value (used Round function) here like 4, 3, 1. The moment I type Number 8 the function should give the output stated above. The names should repeat as per correspond value.

can anyone provide best solution for this requirement.

Thanks,
 
I don't know what do you mean,Here's what I understood:
Column A is the times the value of column B should be repeated and each time you change the value of a cell in column A the value of column B should be automatically repeated in column C?
ZAX
 
Upvote 0

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