I am trying to exclude text from arrays in a SUMPRODUCT function.
The formula I am using is:
=SUMPRODUCT(--ISNUMBER(FIND("S",Schedule!$AT$14:$DP$100)),(Schedule!$AT12:DP12>=D29)*(Schedule!AT12:DP12<=E29)*(Schedule!$A14:A100="VP")*((Schedule!$AT$14:$DP$100)))
Schedule!$AT$14:$DP$100: contains numbers and S (or s)
Schedule!$AT12:DP12: contains dates
D29 contains a date
Schedule!AT12:DP12: contains dates
E29 contains a date
Schedule!$A14:A100: contains various text of which I only want lines with VP in them included.
If I change Schedule!$AT$14:$DP$100 to Schedule!$AT$14:$DO$100 then it works, so I know if is the S in the cell that creates the error. I know I can't multiply an number by an S.
I also tried:
=SUMPRODUCT(--SUBSTITUTE(Schedule!$AT$14:$DP$100,"S",0),(Schedule!$AT12:DP12>=D29)*(Schedule!AT12:DP12<=E29)*(Schedule!$A14:A100="VP")*((Schedule!$AT$14:$DP$100)))
I also tried, but to no avail.
=SUMPRODUCT(SUBSTITUTE(Schedule!$AT$14:$DP$100,"S",0)*(Schedule!$AT12:DP12>=D29)*(Schedule!AT12:DP12<=E29)*(Schedule!$A14:A100="VP")*((Schedule!$AT$14:$DP$100)))
=SUMPRODUCT(SUBSTITUTE(Schedule!$AT$14:$DP$100,"S",0)*(Schedule!$AT12:DP12>=D29)*(Schedule!AT12:DP12<=E29)*(Schedule!$A14:A100="VP"))
Basically what I am trying to say is:
If the cell is in a date range and has VP in the line then add up the cells in the range AT14:DP100 on the Schedule Sheet. So it will be the sum of [number x 1(true) x 1(true) x 1(true)] + [number x 0(false) x 1(true) x 1(true)]...
Where am I going wrong? I feel I may need to use an array formula (CTRL SHIFT and ENTER)
Due to the number of functions that won't automatically operate as Arrays in a SUMPRODUCT, you probably need to use an Array Formula. (i.e. use Ctrl + Shift + Enter)
Fortunately, you're already done all the heavy lifting involved. All we're going to do is re-write your current SUMPRODUCT(<Condition>,<Values>) as {SUM(IF(<Condition>,<Values>,0))}:
{=SUM(IF(ISNUMBER(FIND("S",Schedule!$AT$14:$DP$100)),(Schedule!$AT12:DP12>=D29)*(Schedule!AT12:DP12<=E29)*(Schedule!$A14:A100="VP")*((Schedule!$AT$14:$DP$100)),0))}
Related
So i try return value from table which has same percentage using Index match, but it return the same value twice instead of another value that has the same percentage
Here is my Excel View, is there any help for my problem?
Here is my excel formula
enter image description here
1st: you can't and shouldn't use Match(...,...,-1) in unsorted data, use Match(...,...,0) only
2nd: you can't search for the 2nd similar because... the program has no way of knowing there are 2|3... similar objects. So you must get the positions of ranks when sorting them, and then use that position to get the score and value you want with index(). So Sorting and getting the Position (or ROW()) must be done same time.
3rd: the way to do this is with Matrix formulas that work for on a pre-specified number of cells: So you can look in a table of 200 elements for 10 results and have provision to avoid errors if results are <10, but you'll never get 11. Also Hide the column with the positions to gain clarity...
try this formula:
= LARGE( ROUND( OFFSET($B$3,,,$G$1)*1000,0)*100 + ROW(OFFSET($A$1,,,$G$1)),ROW(OFFSET($A$1,,,$G$2)) )
to get a sorted list from column B Starting w B3 with N rows (N specified in G1) and look for m results (m specified in g2). Offcourse adjust the bolds as needed for your project
4th: Enter the formula in a Column that you will hide, with ctrl+shft+Enter (to enter as matrix) and expand it in as many cells as the results you expect (in the example 2) by selecting them starting with the cell with Array-formula, then F2 (to edit formula) and ctrl+sht+enter. Mind that Arrays can only be EXPANDED, if you want to shrink it you have to delete it and rebuild it...
5th: get the Index with =MOD( ... ,100) ,where ... are the results from steps 3&4
1ST AGAIN: Another simple solution (*not to my Liking). Within your Match(item,range,-1) you should compare item with previous item and use Offset. In your formula you can write:
=Index($C$12:$C$23, Match(DF19, Offset( $CQ$12:$CQ$23 ,if(DF19=DF18, Match(DF19,$CQ$12:$CQ$23,0),0) ,-1) ))
thus pushing the search matrix further down to avoid finding the same.
(added code with BOLD, rest should be same to your original code)
I have a data set formatted as table in Excel 2019. What I would like to achieve is a regression analysis, but only for those records in data set, where we have 'X' in E column which is named IncludeInRegression.
Known Y's are in column F (Price) and known X's are in columns B:D (L, W, Volume).
I have managed to make it work for one independent variable X (variable L in column B) and here is the array formula:
=LINEST(
INDEX(F:F;N(IF(1;MODE.MULT(IF(tblData[IncludeInRegression]={"X","X"};ROW(tblData[Price]))))));
INDEX(B:B;N(IF(1;MODE.MULT(IF(tblData[IncludeInRegression]={"X","X"};ROW(tblData[L]))))));
TRUE;FALSE)
However, I cannot make it work for 3 independent variables. I have tried the following array formula, but #VALUE! is returned:
=LINEST(
INDEX(F:F;N(IF(1;MODE.MULT(IF(tblData[IncludeInRegression]={"X","X"};ROW(tblData[Price]))))));
INDEX(B:D;N(IF(1;MODE.MULT(IF(tblData[IncludeInRegression]={"X","X"};ROW(tblData[[L]:[Volume]]))))));
TRUE;FALSE)
So it will be easier for you to visualize, I am attaching an image as well.
You need to include another array of the column numbers in the second INDEX so it returns all three columns:
=LINEST(
INDEX(F:F,N(IF(1,MODE.MULT(IF(tblData[includeinRegression]={"X","X"},ROW(tblData[Price])))))),
INDEX(B:D,N(IF(1,MODE.MULT(IF(tblData[includeinRegression]={"X","X"},ROW(tblData[[L]:[Volume]]))))),N(IF(1,{1,2,3}))),
TRUE,FALSE)
Depending on ones version this may need to be array entered by selecting four horizontal cells, putting the formula in the formula bar and using Ctrl-Shift-Enter instead of Enter when leaving edit mode
I have a series of data. That goes down the left side column of dates...
8/2, 8/3, and such. Then 2 columns over I have a column left for if the date is checks so 8/2:X, 8/3:X, 8/4: ,8/5: and such. I'm wanting to reference the date in the last field that has a X in it
A B C D
8/1 X
8/2 X
8/3 x
8/4
8/5
Trying to reference the date for the last A cell if there is an X in the D cell. So it would be for 8/3 would be the date. I'm not sure how to run with this.
I've looked through but now sure how to state an if statement
To return the date in column A that is in the same row as the last "X" (or "x") in column D:
=LOOKUP(2,1/(D:D="X"),A:A)
If you only want you cells to calculate if there's an X in column E you could write it like this:
=if(E3="x","", [put your calculation here] )
If you only care if there's anything there, not necessarily an "x" or if you're worried about case sensitivity:
=if(isblank(E3),"", [put your calculation here] )
Then just drag this formula down.
Based on what you had told me use the following formula in cell H1:
=maxifs($A$3:$A$24,$E$3:$E$24,"x")
If I understood correctly, you want to return the highest date with a X in it right? You can simulate a MAX IF with array formulas:
{=MAX(IF(E:E="X",A:A,FALSE))}
(You have to enter the formula with CTRL + SHIFT + ENTER to get those brackets and to it work properly)
The IF part inside that formula returns only a list of values (inside the TRUE part) that the condition returns true
Edit: If you're using Excel 2013 and above, you should check #Mark answer, as it is a cleaner way to do it
Just going to throw my hat in the ring here for a formula that will display the value of date that corresponds to the largest row number with an X in it in column D.
AGGREGATE will find the row number as follows:
=AGGREGATE(14,6,ROW(D:D)/(D:D="x"),1)
That can be nested inside an INDEX function to return the cell address of corresponding date which in turns display the value of the cell as follows:
=INDEX(A:A,AGGREGATE(14,6,ROW(D:D)/(D:D="x"),1))
While the above does work, AGGREGATE is performing array operations. Therefore full column references like D:D should be avoided and reduced to a smaller range that would closer match your data in order to avoid excess calculations on blank cells.
If you can ONLY enter the X consecutively without skipping a date, for instance you would not mark 8/6 X if 8/5 has no X marked, then you can find the last date using the following formula:
=INDEX(Column_Date,COUNTIF(Column_X,"X"))
The look up is case insensitive which means you can also enter lowercase x instead of uppercase X in column D or mix them up, the formula will return the same result anyway.
The solution is using COUNTIF function to locate the position of the last X in Column E of your worksheet, and then use INDEX function to return the corresponding date in Column A.
COUNTIF is a combination of COUNT and IF function. I guess this might be the "IF" function you are after.
Please note if the X is not marked consecutively day by day, you may need to use someone else' answer.
Cheers :)
I have a table in Excel from A1:A5
a
a
b
a
b
I want to find the row of the nth occurrence of the value 'a' using Excel Functions and not VBA
If I put in 1 into this function, I want to get 1.
If I put in 2 into this function, I want to get 2.
If I put in 3 into this function, I want to get 4
A solution that works is to add the following formula
=COUNTIF($A5:A5,"a") in B1 and then drag it down to B5.
I can then use =MATCH(C1,B1:B5,0) where C1 holds the variable n.
However is there a neater way without having to add extra columns?
=AGGREGATE(15,6,1/(myMatch=myRange)*ROW(myRange),Occurrence)
The 1/(..) portion of the formula converts non-matches to DIV/0! errors, which the AGGREGATE function can ignore. So the Smallest value will be the first matching value; etc.
this should work ARRAY FORMULA: CTRL + SHIFT + ENTER
=SMALL(IF(C1=$A$1:$A$5,ROW($A$1:$A$5)),$C$2)
How can I find the max date that is less than today in a range that is mixed with both ACTUAL and PROJECTED Dates:
as you see here I have a row of dates. Some dates are actual, others are projected. I want to open the spreadsheet and say "What is the latest PROJECTED date that is less than today?"
If you want to do it in a single formula, you will need to use an Array formula. Array formulas calculate something multiple times, once for each cell in a range, and provide you with an array of responses. To solve part 1 of what you're asking, the array formula would look like this (Assuming your columns end at H, and are on row 2 only):
=MAX(if(A1:H1="PROJECTED",A2:H2,""))
When this is typed into the formula bar, confirm with CTRL + SHIFT + ENTER, instead of just ENTER. It will look like this afterwards (do not type the {} yourself):
{=MAX(if(A1:H1="PROJECTED",A2:H2,""))}
This looks at each cell from A1:H1. Where it says "PROJECTED", it then gives the value in A2:H2 for that column [otherwise it gives ""]. To find which date is the highest, we wrap it in the MAX function.
But we're not done, because you have other criteria. Normally you could use the AND function for this, but AND functions take array results and collapse them into a single value. So we need to use the natural TRUE / FALSE function of the IF statement instead, like so:
=MAX(if(A1:H1="PROJECTED",if(A2:H2<today(),A2:H2,""),""))
This checks where in row 1 = "PROJECTED", while at the same time that column in row 2 is less than the value of today's date. It then provides you with that date. It takes the highest date shown. Remember to confirm with CTRL + SHIFT + ENTER, instead of just ENTER.