Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-02-2012, 01:01 AM
tomlam tomlam is offline count w and write into another column in excel Windows 7 64bit count w and write into another column in excel Office 2007
Advanced Beginner
count w and write into another column in excel
 
Join Date: Oct 2012
Posts: 33
tomlam is on a distinguished road
Default count w and write into another column in excel

Hi all

I face a problems that is i need to count how many w in column B and write into column C frequently in Excel .how to write VBA code to automatic
count and write total w as follow column c. Because i need to estimate the performance of thousand of students frequently

Column A / column B / column C
peter / good;(2w2w)slow/ 4w
mary/ good /
john/ not bad(1w1w1w1w)/ 4w
alxe /good/
tom /bad(2w4w5w3w) / 14w
simon/ good(1w2w3w)/ 6w

Please kindly note Mary and Alxe column b do not contain w , so column c don't contain w also

Thanks
Tom


Last edited by tomlam; 10-02-2012 at 06:39 PM.
Reply With Quote
  #2  
Old 10-04-2012, 09:19 PM
macropod's Avatar
macropod macropod is offline count w and write into another column in excel Windows 7 64bit count w and write into another column in excel Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You can do this with a forumula:
=(LEN(B2)-LEN(SUBSTITUTE(B2,"1w","")))*1+(LEN(B2)-LEN(SUBSTITUTE(B2,"2w","")))*2+(LEN(B2)-LEN(SUBSTITUTE(B2,"3w","")))*3+(LEN(B2)-LEN(SUBSTITUTE(B2,"4w","")))*4+(LEN(B2)-LEN(SUBSTITUTE(B2,"5w","")))*5+(LEN(B2)-LEN(SUBSTITUTE(B2,"6w","")))*6+(LEN(B2)-LEN(SUBSTITUTE(B2,"7w","")))*7+(LEN(B2)-LEN(SUBSTITUTE(B2,"8w","")))*8
where the data are in B2.

The above formula caters for up to 8w - you can add more expressions if you need.

Note that I haven't bothered adding the 'w' to the formula results. You could do that with a custom number format (0w).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 10-05-2012, 12:04 AM
tomlam tomlam is offline count w and write into another column in excel Windows 7 64bit count w and write into another column in excel Office 2007
Advanced Beginner
count w and write into another column in excel
 
Join Date: Oct 2012
Posts: 33
tomlam is on a distinguished road
Default

sorry paul
after put the formula in column c, peter show 8(actual is 4) john show 8(actual is 4) tom show 28(actual is14)
thanks
Reply With Quote
  #4  
Old 10-05-2012, 01:36 AM
tomlam tomlam is offline count w and write into another column in excel Windows 7 64bit count w and write into another column in excel Office 2007
Advanced Beginner
count w and write into another column in excel
 
Join Date: Oct 2012
Posts: 33
tomlam is on a distinguished road
Default

Hi Paul, thank you missing /2 .... now the formula workable
thank for your excellent knowledge

=(LEN(B2)-LEN(SUBSTITUTE(B2,"1w","")))/2*1+(LEN(B2)-LEN(SUBSTITUTE(B2,"2w","")))/2*2+(LEN(B2)-LEN(SUBSTITUTE(B2,"3w","")))/2*3+(LEN(B2)-LEN(SUBSTITUTE(B2,"4w","")))/2*4+(LEN(B2)-LEN(SUBSTITUTE(B2,"5w","")))/2*5+(LEN(B2)-LEN(SUBSTITUTE(B2,"6w","")))*/2*6+(LEN(B2)-LEN(SUBSTITUTE(B2,"7w","")))/2*7+(LEN(B2)-LEN(SUBSTITUTE(B2,"8w","")))/2*8
Reply With Quote
  #5  
Old 10-05-2012, 09:34 AM
macropod's Avatar
macropod macropod is offline count w and write into another column in excel Windows 7 64bit count w and write into another column in excel Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Simpler:
=((LEN(B2)-LEN(SUBSTITUTE(B2,"1w","")))*1+(LEN(B2)-LEN(SUBSTITUTE(B2,"2w","")))*2+(LEN(B2)-LEN(SUBSTITUTE(B2,"3w","")))*3+(LEN(B2)-LEN(SUBSTITUTE(B2,"4w","")))*4+(LEN(B2)-LEN(SUBSTITUTE(B2,"5w","")))*5+(LEN(B2)-LEN(SUBSTITUTE(B2,"6w","")))*6+(LEN(B2)-LEN(SUBSTITUTE(B2,"7w","")))*7+(LEN(B2)-LEN(SUBSTITUTE(B2,"8w","")))*8)/2
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 10-07-2012, 06:09 AM
tomlam tomlam is offline count w and write into another column in excel Windows 7 64bit count w and write into another column in excel Office 2007
Advanced Beginner
count w and write into another column in excel
 
Join Date: Oct 2012
Posts: 33
tomlam is on a distinguished road
Default

yes it is more simpler Thanks Paul
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
count w and write into another column in excel How to write the degree, minute second format in excel Jamal NUMAN Excel 12 07-09-2018 11:44 PM
Is it possible to write down a number starting with zero in excel cell? Rahmat_uk20 Excel 3 06-08-2012 02:26 AM
count w and write into another column in excel Read text Report file with VBA and write parsed fields to Excel workbook tpcervelo Excel Programming 1 01-05-2012 10:14 PM
count w and write into another column in excel Word Count in Excel dallas Excel 1 11-23-2011 09:20 AM
count w and write into another column in excel Count in Excel zanat0s Excel 3 06-09-2011 10:53 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft