Excel Named range using *? in order to count only relevant cells - excel

Would like to use named range in order to find all relevant values in a range. However after several differrent approaches it seems that I cant't progress from here. Using *? in countif formula in order to get all text or values in the range, however it does not count the last cell with a text in the cell for some reason
=OFFSET(DATAMATCH!$I$7;0;0;COUNTIF(DATAMATCH!$I:$I;"*?");1)

An assumption:
Your range in column H are all these names
Column I range needs to have the same size as column H
The tricky part is that there are empty cells by formula in column H
So you could try the following (in my test a named range called TestRange2):
=DATAMATCH!$I$7:INDEX(DATAMATCH!$I:$I,MIN(IF(DATAMATCH!$H$7:$H$50="",ROW(DATAMATCH!$H$7:$H$50)))-1)
This way it's also non-volatile (or rather; semi-volatile), which using OFFSET wouldn't be.

Without the sheet's headings just guesswork, but worth trying changing that 7 to 8.

Related

SUMIFS where the "sum_range" column is unknown

I have a pile of data on Sheet1
I have a SUMIFS formula on Sheet2
The columns I am summing are named NETPERD1, NETPERD2, NETPERD3.....NETPERD12
I want to write the SUMIFS so that I can easily change which column I am summing.
On Sheet2, in cell $C$4, I will enter NETPERD1 or NETPERD2 etc. and I want my SUMIF to determine which column it should sum.
I think I should be able to do this with IndexMatch but I can't get it to work.
Here is my SUMIFS that works.
I want to replace NETPERD1 with $C$4
=SUMIFS(Sheet1!NETPERD1,Sheet1!ACCTGRPCOD,Perplas!$A15,Sheet1!AUDTORG,Perplas!C$1,Sheet1!FSCSDSG,Perplas!C$2,Sheet1!FSCSYR,Perplas!C$3)
If your named ranges span the entire column, then for the INDEX/MATCH try:
=SUMIFS(INDEX(Sheet1!$A:$Z,,Match(Perplas!C$4,Sheet1!A$1:Z$1,0)),...
changing the Z to your rightmost column.
Try using the indirect function. You can supply indirect with a character string that Excel then reads as part of a cell/range reference.
Working off the code you shared + the fact that you said that you'll put in the name of the range in cell C4:
=SUMIFS(INDIRECT("Sheet1!"&$C$4),Sheet1!ACCTGRPCOD,Perplas!$A15,Sheet1!AUDTORG,Perplas!C$1,Sheet1!FSCSDSG,Perplas!C$2,Sheet1!FSCSYR,Perplas!C$3)
I think that should work? I'm a little confused about how you're able to reference the row name without a named range, so that might cause a wrinkle in this.

excel formula to Countif none sequential cells

I am trying to build a formula to calc the percentage of cells that are not "x" in a non-sequential range.
ie...
=COUNTIF(H10,N10,T10,Z10,AF10,AL10,B14,H14,N14,T14,Z14,AF14,AL14,B19,H19,N19,T19,Z19,AL19,B23,H23,N23,T23,Z23,AL23,"x")
I also tried using a named range
=(COUNTIF(my_rng,"x")
but neither are working
if there is a better way using countifs to do this as well that would help
essentially I want to find the percentage of a,b,c so if there is a way to countif header cell is "a" and cell directly under that is x?
output would be
A: 3
Assuming your sample is in Range A1:L11 and the strings a, b and c and in P2:P4, insert the following in Q2:
=COUNTIFS(A$2:L$10,P2,A$3:L$11,"x")
and populate down
edit: changed to Scott's more elegant solution

COUNTIF range exclude header

=COUNTIF('sheet'!A:A, "*Pdf*")
This formula gives me no problem in general, but because the word pdf is part of the header cell, it gives me a wrong value from what I am actually trying to count (the actual data)
Some people have suggested that I select the range by doing shift+ctrl+down arrow, and it seems to work seamlessly for sum formula, (as in if I add in more values under the said range, it automatically adjusts the value) but when it is with countif, using that solution will not include any new data input.
The whole reason I want to have the range be the whole row is so that when new data gets added, the formula will automatically adjust itself.
So ultimately what I am trying to do is have the whole row selected as a range, except for the header cell (which in this case would be A1) Changing A:A to A2:A didn't work either.
This should do the trick
=COUNTIF('sheet'!$A2$:A, "*Pdf*")
=COUNTIF('sheet'!A:A, "*Pdf*")-1
This formula should work:
=COUNTIF($A$2:A, "pdf")

How to reference cell within '' worksheet title

I have the names of the tabs/worksheets (M-61,M-62,M-63W) at the top row (A1, B1, C1...etc)
I am trying to get a sum of several cells within the different sheets:
=SUM('M-60'!H21,'M-60'!H43,'M-60'!H86,'M-60'!H87,'M-60'!H97,'M-60'!H98)
However, right now I’m referring to the sheet itself, and have to apply the same formula to all the other sheets. This will require me to manually go and change all the sheet titles accordingly.
I was wondering if there is any way to reference the top row with the sheet titles within the formula so it automatically refers to the row text instead of me having to manually change the sheet title.
Edit
Now i got the reference to work, just wondering how would I do a sum of several cells in that tab
=INDIRECT("'"&$F1&"'!H87",TRUE)
Maybe:
=SUM(INDIRECT("'"&C1&"'!H21"),INDIRECT("'"&C1&"'!H43"),INDIRECT("'"&C1&"'!H86:H87"),INDIRECT("'"&C1&"'!H97:H98"))
(though there may well be a much smarter way).
You can use the INDIRECT function, which uses a string as an argument and converts it to a range. So
=M-60'!H21
is the same as
=INDIRECT("M-60'!H21")
or, if Sheet name is stored in, say, cell C1:
=INDIRECT(C1&"'!H21")
Your example has a SUM, though, which requires some adaptations. This your example:
=SUM('M-60'!H21,'M-60'!H43,'M-60'!H86,'M-60'!H87,'M-60'!H97,'M-60'!H98)
Since you are not using a range, you can convert that SUM into simple addition. Assuming Sheet name in cell C1
=INDIRECT("'"&C1&"'!H21")+INDIRECT("'"&C1&"'!H43")+INDIRECT("'"&C1&"'!H86")+INDIRECT("'"&C1&"'!H87")+INDIRECT("'"&C1&"'!H97")+INDIRECT("'"&C1&"'!H98")
This should solve your problem. More info here
By the way, if you were using a range, the OFFSET function with INDIRECT as an argument would work. But that's not necessary here.

Excel - How to use the value of a cell as the row value of another cell?

Here is my problem:
I have a cell (V4) containing the value 444. I want to use this value in the formula of another cell (M12) in the following way. I want the formula to be equivalent to =MIN(L12:L444) but instead of 444 I want to refer to cell V4 which contains the value 444. But when I type in =MIN(L12:L(V4)) it obviously doesnt work so how do I do it? Sorry if I didn't explain it very well. :S
Would this work for you:
=MIN(L12:INDIRECT("L"&$V$4))
From: Excel - INDIRECT and Using the value in a cell as a cell reference in a formula?
INDIRECT will work and is closest to the solution you described, but I prefer OFFSET, which uses proper references. (For example, if you insert a column in the sheet before L, INDIRECT will break while OFFSET will just update its reference as expected.
Two ways to go with OFFSET:
1 - Start at L$1 and go down $V$4-1 rows. (This will work with $V$4 as you've defined it now.)
=MIN(L12:OFFSET(L$1,$V$4-1,0))
2 - In $V$4, provide the height of the range you want.
=MIN(OFFSET(L12,0,0,$V$4,0))
It's hard to make suggestions without more context, but I'm sure you can tweak one of these patterns to meet your needs.
I am not sure if you are trying to include all of the values in 1 column and then on non-contiguous cell. If so, it should look like = Min(L12:L444,V4) . The L12:L444 looks at the value in every cell in the L column from 12 - 444.
So you can check individual cell (A3, D15, Q54) with commas, or a range of cells (A3:Z54) with a colon. Or a range and a specific cell like above =Min(L12:L444, V4).

Resources