I have a formula in Excel, which is almost working. However, there is a part of the formula which no matter, what I try and do I can't seem to get it to work.
Working Formula
=IFERROR(INDEX(DDRT!$K$7:$K$158,SMALL(IF(DDRT!$K$7:$K$158<>"",MATCH(ROW(DDRT!$K$7:$K$158),ROW(DDRT!$K$7:$K$158)),""),ROW(A1))),"")
This formula will create a list and ignore any blanks in the Array K7 to K158, which is exactly what I am trying to do, however, it is the Value K that is a variable and is based on a list in another sheet.
I have a concatenate which returns the correct value based on the list, which works fine.
Concatenate Formula
=CONCATENATE("DDRT!",ADDRESS(List!$E$6,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0)),":",ADDRESS(List!$E$7,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0)))
Value Returned - DDRT!$K$7:$K$158
When I try and combine the two formulas together, the array doesn't work and returns an error:
Non-working formula
=IFERROR(INDEX(CONCATENATE("DDRT!",ADDRESS(List!$E$6,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0)),":",ADDRESS(List!$E$7,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0))),SMALL(IF(CONCATENATE("DDRT!",ADDRESS(List!$E$6,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0)),":",ADDRESS(List!$E$7,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0)))<>"",MATCH(ROW(CONCATENATE("DDRT!",ADDRESS(List!$E$6,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0)),":",ADDRESS(List!$E$7,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0)))),ROW(CONCATENATE("DDRT!",ADDRESS(List!$E$6,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0)),":",ADDRESS(List!$E$7,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0))))),""),ROW(A1))),"")
Image of Returned Error Message
=IFERROR(INDEX(INDIRECT(CONCATENATE(ADDRESS($E$6,MATCH($D$3,$A$6:$L$6,0)),":",ADDRESS($E$7,MATCH($D$3,$A$6:$L$6,0)))),SMALL(IF(INDIRECT(CONCATENATE(ADDRESS($E$6,MATCH($D$3,$A$6:$L$6,0)),":",ADDRESS($E$7,MATCH($D$3,$A$6:$L$6,0))))<>"",MATCH(ROW(INDIRECT(CONCATENATE(ADDRESS($E$6,MATCH($D$3,$A$6:$L$6,0)),":",ADDRESS($E$7,MATCH($D$3,$A$6:$L$6,0))))),ROW(INDIRECT(CONCATENATE(ADDRESS($E$6,MATCH($D$3,$A$6:$L$6,0)),":",ADDRESS($E$7,MATCH($D$3,$A$6:$L$6,0)))))),""),ROW(A1))),"")
That is your formula with indirect in it. I had to remove sheet names so I could enter it in excel. It does not have your error message. All I did was wrap your concatenate formula in an indirect formula.
=INDIRECT(CONCATENATE("DDRT!",ADDRESS(List!$E$6,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0)),":",ADDRESS(List!$E$7,MATCH(Transmittal!$D$3,DDRT!$A$6:$L$6,0))))
Related
In Google Sheets, it's possible to create an array with formulas with in it. For example, ={SUM(1,2);SUM(3,4)} evaluates to a column with the numbers 3 and 7.
When I try the same thing in Excel, I get a formula syntax error. Is a similar thing possible? I've also tried putting names defined with LET in an array, but that throws the same error.
Thanks!
You can use CHOOSE function to combine formulas in array:
=CHOOSE({1;2},SUM(1,2),SUM(3,4))
formula works for O365, for earlier versions select desired count of cells and enter formula in first cell as array formula (with CSE).
I have a column in a spreadsheet in which numbers are sometimes
stored in text format or are mixed with text values.
For converting them to numbers I would
normally use VALUE. And because of the other text values in the same column I would additionally wrap it
with IFERROR, defaulting the result to 0 to prevent any issues with the
conversion.
All this I wanted to use in SUMPRODUCT and I am reluctant to add any new intermediate columns to the sheet.
I face an issue with IFERROR returning a single value (or even a #VALUE! error) when it is used in SUMPRODUCT as one of the arrays. What's even worse, the sum is correctly assessed in the Function Arguments window.
I created an isolated case, that you can see here SUMPRODUCT using IFERROR problem. One of the numbers in column C is preceded with with single quotation "'" and the C column holds both text and number values.
A long version of the SUMPRODUCT formula
=SUMPRODUCT(IFERROR(VALUE($C1:$C4),0),--($D1:$D4="yes"),--NOT(ISERROR($C$1:$C$4+1-1)),--(($C1:$C4)<>"")) and the simplified one =SUMPRODUCT(IFERROR(VALUE(C19:C21),0)). It returns a correct number in the Function Arguments window when in the spreadsheet it shows #VALUE! error or respectively an incorrect sum.
I wonder if I am using the aforementioned functions wrong (can't IFERROR be used as an array here?), or is this some sort of an Excel bug (why the assessed value is different from the result in the spreadsheet?).
Thanks in advance for your comments and suggesting a solution.
Your formula :
=SUMPRODUCT(IFERROR(VALUE($C1:$C4),0),--($D1:$D4="yes"),--NOT(ISERROR($C$1:$C$4+1-1)),--(($C1:$C4)<>""))
and
=SUMPRODUCT(IFERROR(VALUE(C19:C21),0))
all need to be confirmed with Ctrl+Shift+Enter
Another option,
Change your formula into :
=SUMPRODUCT(N(+$C1:$C4),--($D1:$D4="yes"),--NOT(ISERROR($C$1:$C$4+1-1)),--(($C1:$C4)<>""))
and
=SUMPRODUCT(N(+C19:C21))
the change using N(+.... instead of IFERROR(VALUE(....
also, the above 2 formulas need not array entry
I am trying to write a formula in Excel that will find the closest match in one column and return that value, so that it can be used in a SUMIFS formula. I have done some investigating and found that everyone points at this specific formula:
{=INDEX(data,MATCH(MIN(ABS(data-value)),ABS(data-value),0))}
The issue I am having though is I am trying to convert this to use data from a Table and have this so far:
{=INDEX(_CCD01[[#All],[Date]],MATCH(MIN(ABS(_CCD01[[#All],[Date]]-TODAY())),ABS(_CCD01[[#All],[Date]]-TODAY()),0))}
But Excel returns a #VALUE! error.
What the formula needs to do, is find the closest date in column _CCD01[[#All],[Date]] using TODAY() as the search criteria.
The file with the table and formula can be found here:
Dropbox Read Only
Any help or thoughts will be appreciated.
Dave
This is an array formula.
=INDEX(_CCD01[Date],MATCH(MIN(ABS(_CCD01[Date]-TODAY())),ABS(_CCD01[Date]-TODAY()),0))
To enter/confirm an array formula, hold down ctrl + shift while hitting enter. If you do this correctly, Excel will place braces {...} around the formula seen in the formula bar.
The syntax you were using _CCD01[[#All],[Date]] will also return the header row of the column. There's no need for this, and it is the cause of your #VALUE! error.
The ABS function will return a #VALUE error (as the first element) in the array it returns when applied against the column since the first entry is text.
And then MIN arguments that are error values or text that cannot be translated into numbers cause errors.
I am trying to get a sumproduct function to average a column based on criteria in prior adjacent columns.
The column i am trying to average is calculated from a formula that has an IFERROR to return a blank if there is an error.
=IFERROR(A5*B3,"")
some of the cells in that column containt the blank generated by the if error statement, my sumproduct is giving a #value error when it tries to average the range with the blank. I want it treated as nothing not as 0
Is there anyway around this or should I try to recreate my sumproduct using some sort of averageifs function?
This is the sumproduct in question:
=SUMPRODUCT((Data!$KM$7:$OV$7=C$7)*(Data!$KM$9:$OV$118>=$B10)*(Data!$KM$9:$OV$118<=$A10)*(Data!$BLW$9:$BLW$118))/SUMPRODUCT((Data!$KM$7:$OV$7=C$7)*(Data!$KM$9:$OV$118>=$B10)*(Data!$KM$9:$OV$118<=$A10))
Try this array formula instead:
=AVERAGE(IF((Data!$KM$7:$OV$7=C$7)*(Data!$KM$9:$OV$118>=$B10)*(Data!$KM$9:$OV$118<=$A10)*(Data!$BLW$9:$BLW$118<>""),Data!$BLW$9:$BLW$118))
Being an array it needs to be confirmed with Ctrl-Shift-Enter when leaving edit mode. If done properly excel will put {} around the formula.
The reason SUMPRODUCT will not work is it tries to multiply a string, albeit an empty string but a string none the less, with numbers, which will throw an error.
The array formula ignores all the empty string cells and skips them.
The formula =IFERROR(A5*B3,"") puts a "" in the cell. This is not a value, so formulas using this cell won't work. You need to turn it to a numeric value even though it is blank
Use =value(IFERROR(A5*B3,""))
=SUMPRODUCT(P10,M10,L14,L13). This could be easy. We have to write what we want to do rather it is sum, product, division or subtract
I've put together an Excel spreadsheet to keep track of employees' time off using an array formula. The formula works for date ranges that are entered as "mm/dd - mm/dd", but I'd like it to also support single dates "mm/dd". However, I get a #VALUE! error when one of the cells in the range is of this format, even though the formula supports both formats when not entered as an array formula.
Example:
With the value "11/28" in cell B2, and a table of holidays in B31:B37, the following formula accurately calculates the number of work days as 1.
=SUM(IF(ISBLANK(B2),0,(IF(ISERR(FIND("-",B2)),NETWORKDAYS(B2,B2,$B$31:$B$37),NETWORKDAYS(LEFT(B2,5),MID(B2,FIND("- ",B2)+2,5),$B$31:$B$37)))))
If the value of B2 is "11/28 - 12/03", the formula returns 4.
I want this formula to work over a range of of cells for each employee, so I expand the range from "B2" to "B2:B10", and enter as the following array formula:
=SUM(IF(ISBLANK(B2:B10),0,(IF(ISERR(FIND("-",B2:B10)),NETWORKDAYS(B2:B10,B2:B10,$B$31:$B$37),NETWORKDAYS(LEFT(B2:B10,5),MID(B2:B10,FIND("- ",B2:B10)+2,5),$B$31:$B$37)))))
This formula works fine when every cell in the range is blank or has a date range of "mm/dd - mm/dd". However, if one of the cells has a single date "mm/dd", it throws a #VALUE! error.
What am I missing?
If there is no "-" in a given string then the FIND function will return a #VALUE! error for that string.
In general, there are two ways to resolve such issues. One is to include an error trap; the other, slightly longer though perhaps nevertheless preferable (IFERROR clauses are generally best avoided if possible), is to make suitable amendments to the strings being passed to MID and FIND such that this combination of functions does not error, whilst also ensuring that correct results are returned.
One such solution (still array-entered) is:
=SUM(IF(B2:B10<>"",NETWORKDAYS(LEFT(B2:B10,5),MID(B2:B10&"- "&B2:B10,FIND("- ",B2:B10&"- ")+2,5),$B$31:$B$37)))
Regards