VB Code / Formula - in sheet

Vishaal

Well-known Member
Joined
Mar 16, 2019
Messages
543
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
  2. Web
Hi All,

Thanks in advance.

i have the below sheet

[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]S.No.[/TD]
[TD]Number [/TD]
[TD]Description[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]8[/TD]
[TD]Na[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]7[/TD]
[TD]Na[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]9[/TD]
[TD]Na[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]6[/TD]
[TD]Na[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]7[/TD]
[TD]Na[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]6[/TD]
[TD]Na[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]7[/TD]
[TD]Na[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]8[/TD]
[TD]Na[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]3[/TD]
[TD]Na[/TD]
[/TR]
</tbody>[/TABLE]

Now i want the result in fourth column (It will check the numbers of "Na" from description column and show the number in "Result" column), please check the below table

[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]S.No.[/TD]
[TD]Number [/TD]
[TD]Description[/TD]
[TD]Result[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]8[/TD]
[TD]Na[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]7[/TD]
[TD]Na[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]9[/TD]
[TD]Na[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]6[/TD]
[TD]Na[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]7[/TD]
[TD]Na[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]6[/TD]
[TD]Na[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]7[/TD]
[TD]Na[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]8[/TD]
[TD]Na[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]3[/TD]
[TD]Na[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]

in "Result" column i am also checking that the how many times showing result is repeated,
i mean
One= 2 times
Two= 2 times
Three = One time
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Something like this?
Each formula copied down.

Excel Workbook
ABCDEF
1S.No.NumberDescriptionResultResultsRepeats
215 12
32322
438Na131
54140
657Na
769Na
876Na3
984
1091
11107Na
12116Na2
13122
14137Na
15148Na2
16154
17163Na1
18
Count Na
 
Upvote 0
Thanks Peter_SSs ji

Many thanks for the quick reply.

Coloumn "F" is great, its working in my case.
Can, may i get the formula/vb code for getting the same result as shown in "D"

Same as in coloumn "D" not as in coloumn "E"
 
Upvote 0
Confused... Peter has already posted the formula for column D :confused:
 
Upvote 0
Thanks Peter_SSs ji

I am really Sorry for my previous reply.

You are great, i don't know how you solveed this type of complex problems easily

Thanks
 
Last edited:
Upvote 0
Thanks Peter_SSs ji

I am really Sorry for my previous reply.

You are great, i don't know how you solveed this type of complex problems easily

Thanks
No problem. You are welcome. Thanks for the clarification. :)
 
Upvote 0
Hi Peter_SSs Ji,

This formula for coloumn "C"
D2 =IF(AND(C2="Na",C3=""),COUNTIF(C$2:C2,"Na")-SUM(D$1:D1),"")

Can we use it for row no. 3, if we copy and transpose all the data

If yes, may i know the change in formula
 
Upvote 0
it is possible, pls confirm
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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