We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
Help! Urgent Excel help needed
Amberdarcy
Posts: 139 Forumite
in Techie Stuff
Hello
I have a spreadsheet which notes 'yes' in the cells. Is there a way of adding how many cells this appears in across a row?
I'm sure this doesn't make sense!
I have a spreadsheet which notes 'yes' in the cells. Is there a way of adding how many cells this appears in across a row?
I'm sure this doesn't make sense!
0
Comments
-
Amberdarcy wrote: »I have a spreadsheet which notes 'yes' in the cells. Is there a way of adding how many cells this appears in across a row?
=COUNTIF(A1:C1,"Yes")
where A1:C1 is your row range.0 -
-
Thank you so much! i'm impressed.0
-
Is there a way of counting how many cells in a word table contain text?0
-
Do you mean a table in Microsoft Word, or a table containing words in Excel?
As a start, there's this about extracting data from Microsoft Word tables:
http://msdn2.microsoft.com/en-us/library/aa537149(office.11).aspx#officewordautomatingtablesdata_extractingdatafromatable
Or this referring to counting cells in Excel:
http://j-walk.com/ss/excel/tips/tip52.htm0 -
Assuming your data is in row 1 starting in column A, you could do:-
=istext(A1) in row 2 for each cell you want to check, and then at the end of either row 1 or 2, count the number of TRUE's:wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:
Any posts are my opinion and only that. Please read at your own risk.0 -
Open your Word document (or a copy of it if you want to play around), press Alt+F11, click Insert - Module, and paste in this code:Amberdarcy wrote: »Is there a way of counting how many cells in a word table contain text?Sub CountCellsWithText() Dim oDoc As Word.Document Dim oTable As Word.Table Dim oCell As Word.Cell Dim r, c, numCells As Integer numCells = 0 Set oDoc = ActiveDocument Set oTable = oDoc.Tables(1) For r = 1 To oTable.Rows.Count For c = 1 To oTable.Columns.Count Set oCell = oTable.Rows(r).Cells(c) If isText(oCell.Range.Text) Then numCells = numCells + 1 End If Next Next MsgBox CStr(numCells) + " cells contain text" End Sub Private Function isText(sText As String) As Boolean Dim i As Integer isText = False i = 1 While i <= Len(sText) And Not isText If Mid(sText, i, 1) > " " Then isText = True Else i = i + 1 End If Wend End FunctionPress F5 to run. NB the code looks at the first table in the document.0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 353.5K Banking & Borrowing
- 254.2K Reduce Debt & Boost Income
- 455K Spending & Discounts
- 246.6K Work, Benefits & Business
- 602.9K Mortgages, Homes & Bills
- 178.1K Life & Family
- 260.6K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards