There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Business Applications
Tag Cloud
access acer asus bios bsod computer crash driver drivers error ethernet excel freeze gaming google gpu hard drive hardware hdmi internet laptop malware memory missing monitor motherboard network operating system printer problem ram registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Excel 2007 Formula Help

Reply  
Thread Tools
beinw's Avatar
Computer Specs
Junior Member with 4 posts.
 
Join Date: Oct 2009
Experience: Intermediate
02-Nov-2009, 02:41 PM #1
Excel 2007 Formula Help
Is it possible to build a formula in Excel 2007 that looks in one column for a particular word (i.e. "shoes") and, when it finds that word, looks in another column for a different word (i.e. "socks") that occurs in the same row as the word in the previous column and, when it finds that word ("socks"), have it count the instances where that word in the second column occurs in the same row as the other word ("shoes") did in the first column? If so, what would that formula look like?
etaf's Avatar
Computer Specs
Moderator with 34,394 posts.
 
Join Date: Oct 2003
Location: Surrey, UK
Experience: Intermediate
02-Nov-2009, 03:09 PM #2
you could put a formula in a column as follows

=IF( A1="shoes", COUNTIF(A1:A??,"socks"), 0)
beinw's Avatar
Computer Specs
Junior Member with 4 posts.
 
Join Date: Oct 2009
Experience: Intermediate
02-Nov-2009, 03:27 PM #3
I think you misunderstood my question. I need to find a word in one column, find a different word in a different column that is in the same row as the word found in the first column and then return the total number of times the second word appears in the same row as the first word. I.e., if "shoes" appears in a cell column A, I want Excel to tell me how many times the word "socks" appears in a cell in column B in the same row that "shoes" appears in column A.

A B
1 shoes bird
2 tree socks
3 bus car
4 shoes socks
5 shoes cheese
6 animal infer

The solution in this case would be "1" since "socks" appears in a cell in column B only one time next to a cell in column A where "shoes" appears.
etaf's Avatar
Computer Specs
Moderator with 34,394 posts.
 
Join Date: Oct 2003
Location: Surrey, UK
Experience: Intermediate
02-Nov-2009, 03:39 PM #4
are you doing this for a specific match of groups - ie Shoes and Socks , any others
or how do you decide on the criteria -
Ok I think I'm getting it having re-read
No criteria - just matching pairs and counting ??
beinw's Avatar
Computer Specs
Junior Member with 4 posts.
 
Join Date: Oct 2009
Experience: Intermediate
02-Nov-2009, 04:00 PM #5
etaf, those are just examples. I need an exact match of words. I have multiple words in one column but need to locate only one particular word, and different words in another column. Please look at the attachment for a sampling of entries and criteria. Does that help clarify what I'm looking for?
Attached Files
File Type: xls Formula Help.xls (32.0 KB, 32 views)
etaf's Avatar
Computer Specs
Moderator with 34,394 posts.
 
Join Date: Oct 2003
Location: Surrey, UK
Experience: Intermediate
02-Nov-2009, 04:07 PM #6
not a particular elegant answer - sure there are much better ways - just looking at match ( and maybe doing something with arrays or VB)

But a slution attached

Concatenate the cells and then use count if
Attached Files
File Type: xls MatchETAF.xls (40.0 KB, 25 views)
beinw's Avatar
Computer Specs
Junior Member with 4 posts.
 
Join Date: Oct 2009
Experience: Intermediate
02-Nov-2009, 04:37 PM #7
etaf, looks good but what if the area expands or contracts based on added or deleted rows? I think we need a formula that adjusts for that. I frequently add and delete rows to my workbook. What do you think?
etaf's Avatar
Computer Specs
Moderator with 34,394 posts.
 
Join Date: Oct 2003
Location: Surrey, UK
Experience: Intermediate
02-Nov-2009, 04:42 PM #8
yep,
you may be able to use a list or in the concatenate and range calcs - just expand to a length you may not exceed

That will work -

I'll try the list and post
etaf's Avatar
Computer Specs
Moderator with 34,394 posts.
 
Join Date: Oct 2003
Location: Surrey, UK
Experience: Intermediate
02-Nov-2009, 04:48 PM #9
OK - so i have used a list function - and added the concatenate into that list
Data
List

Now if you add entries into A and B - it will also calculate in C
and change the range in all the calcs

copy and past additional lines at the * and you will see the list extend column C also extend and calcs
and the formulas counts in F also extend

if you delete rows in the list the same happens
Attached Files
File Type: xls MatchETAF-1.xls (41.0 KB, 44 views)
__________________
Note: I have very limited time during weekdays to visit here, so there will be a delay in replying
UK timezone
Please let us know what the final solution was to any problem posted
wedonttakecrap's Avatar
Junior Member with 7 posts.
 
Join Date: Nov 2009
Experience: Advanced
03-Nov-2009, 04:53 PM #10
I couldn't resist finding an array solution for this problem. (Mostly because I'm secretly punishing myself)

Array formulas have the quirk of having to be entered by pressing Ctrl + Shift + Enter all together once you have the formula worked out in the formula bar.

The basic formula is below. For an in depth- explanation, check out this knowledgebase series.


=SUM(1*((A1:A23="ENROLLED")*(B1:B23="HERE")))
paste that into the formula bar and press Ctrl + Shift + Enter. Excel will then wrap the formula in {curly braces like these}.

You can add more columns by adding another *(array="string") to the others. Use +(array="string") for an OR condition instead of * for an AND.

happy hacking.
Attached Files
File Type: xls MatchETAF-arrays.xls (39.0 KB, 16 views)
etaf's Avatar
Computer Specs
Moderator with 34,394 posts.
 
Join Date: Oct 2003
Location: Surrey, UK
Experience: Intermediate
03-Nov-2009, 06:16 PM #11
I knew arrays would help
But also need a variable range
Can that work on a list range
wedonttakecrap's Avatar
Junior Member with 7 posts.
 
Join Date: Nov 2009
Experience: Advanced
03-Nov-2009, 07:30 PM #12
I just tested the list range, and yes, it works like a charm.

When you say you need a variable range, do you mean that there will be varying columns, or just the row numbers?

Also, are you only going to have the same critera, (ie. "Enrolled, Here, Not Enrolled, There")? Or are you looking to get every unique value from the list, and every possible combination? That would be quite the undertaking.
Attached Files
File Type: xls MatchETAF-array-list.xls (26.5 KB, 18 views)
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 5,030 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
03-Nov-2009, 10:34 PM #13
Non-array entered...
Code:
=SUMPRODUCT(($A$2:A23=E9)*($B$2:B23=F9))
Non-array entered last row not known...
Code:
=SUMPRODUCT(($A$2:INDEX(A:A,MATCH(REPT("z",255),A:A),1)=E15)*($B$2:INDEX(B:B,MATCH(REPT("z",255),B:B))=F15))
These examples split the words up individually. I'll attach the sample file (I borrowed etaf's).

HTH
Attached Files
File Type: xls MatchZB.xls (25.0 KB, 45 views)
wedonttakecrap's Avatar
Junior Member with 7 posts.
 
Join Date: Nov 2009
Experience: Advanced
04-Nov-2009, 11:19 PM #14
</headsmack>
I can't believe I forgot SUMPRODUCT(). That paired with a LIST would probably be the simplest solution.

I tip my hat to you, ZB. Good show.
etaf's Avatar
Computer Specs
Moderator with 34,394 posts.
 
Join Date: Oct 2003
Location: Surrey, UK
Experience: Intermediate
05-Nov-2009, 04:29 AM #15
Quote:
not a particular elegant answer - sure there are much better ways
Yep, was sure there was a better way
as always Zack
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:34 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.