Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I countif a range of cells that is not adjacent?

Posted on 2011-02-22
5
Medium Priority
?
325 Views
Last Modified: 2012-05-11
Several Excel functions require you to have the RANGE or Array of cells be adjancent to each other (A1:A6)....what if my Range or Array is A1, A6, A8, A9, etc.?

I don't want to create a named range for all 400 rows....which is what I am looking at now...

0
Comment
Question by:ContechBridge
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 50

Expert Comment

by:barry houdini
ID: 34952735
The answer might differ depending on the function. COUNTIF, for instance won't even allow you to use a named range if that range is made up of non-adjacent cells.

Is there a pattern, e.g. every 3rd cell? You can then write a formula to count "x" only within every third cell, or simpler, if you have an adjacent column which somehow identifies which rows are included then you can use a SUMPRODUCT or COUNTIFS function

regards, barry
0
 

Author Comment

by:ContechBridge
ID: 34952898
I want to find the MIN of the following cells that DO NOT contain "0"

Q6,S6,U6,AA6,AG6,AM6,AS6
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 200 total points
ID: 34953142
Assuming that those cells are either blank or contain positive numbers try

=LARGE((Q6,S6,U6,AA6,AG6,AM6,AS6),(Q6>0)+(S6>0)+(U6>0)+(AA6>0)+(AG6>0)+(AM6>0)+(AS6>0))

[I know it uses LARGE but it still finds the MIN non zero]

obviously that isn't a viable approach for a large number of cells - for that I think you'd have to use data in another row, e.g. if row 5 for each of those cells (i.e. the cell above) shows an "x" then you could use an array formula like

=SMALL(IF(Q6:AS6>0,IF(Q5:AS5="x",Q6:AS6)),1)

confirmed with CTRL+SHIFT+ENTER

regards, barry
0
 

Author Comment

by:ContechBridge
ID: 34953389
Forgive my ignorance here but, just adding the "()" to the range of non adjancent cells makes it the LARGE function work with non adjacent cells...?

Everything after that is just defining the "K" criteria?
0
 
LVL 81

Expert Comment

by:byundt
ID: 34953806
The parentheses are actually the Union operator. Some (but far from all) functions will work on a union of non-contiguous cells. This union is then treated as a single parameter--a range (with multiple areas)--by the union-savvy functions. So in barryhoudini's suggested LARGE formula, (Q6,S6,U6,AA6,AG6,AM6,AS6) is the union of the seven cells.

Excel also has an Intersection operator--which is the space character. So A1:A6 A3:D4 would return the intersection of those two ranges: cells A3 and A4. Once again, not all functions are intersection-savvy.

Brad
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question