Hi!
I've got a large spreadsheet of text string data (around 500 rows by 20 columns).
First, I want to count the number of occurrences of a given text string occurring anywhere in the sheet.
This is easy to do with the COUNTIF statement. No problems...
Now my question:
Secondly, I need to count the number of occurrences where a given text string occurs anywhere on the sheet AND also a second (different) given text string occurs in the cell immediately to the right of each cell that contains the first text string.
This isn't my actual dataset (I'm not a crazed market gardener!) but I hope the following example illustrates what I'm trying to do:
beans peas tomatoes cabbages
cabbages lettuce peas beans
peas tomatoes cabbages lettuce
I need a function which will look at the entire sheet and COUNTIF ((a cell contains the text string "peas") AND (the cell immediately to its right contains the text string "tomatoes"))
- in this example the function should return the value "2"
I've tried using COUNTIF and VLOOKUP nested in various combinations with the logical AND command, but whereas COUNTIF only needs me to specify the entire data range, VLOOKUP seems to require a specific column index number, and my dataset doesn't allow for this.
Is it possible to do this in Excel 2007?
If so I'd be really grateful for any help you could give me in writing a function which will do this without me having to re-enter my entire dataset in a different format.
Many thanks in anticipation
Dave
Bookmarks