I have following formula which i add as a picture here in the question as well.
=MIN(INDIRECT(ADDRESS(ROW(AF4);COLUMN(AF4))&":af"& (MIN(IF(A4:A108="";ROW(A4:A108))))))
AF3 and AG3 columns should calculate the minimum date in dynamic range(based on empty cell in A). As you can see in AF, if all values are "N/A" formula brings automatically 00.01.1900 by default. I want it to return empty string if the range does not contain any date. If it has a date inside the range, the formula should work as it works in AG3.
How can i do this?
Wrap the formula in IF like below and test:
=IF(MIN(AF4:INDEX(AF:AF,MIN(IF(A4:A108="",ROW(A4:A108)))))=0,"",MIN(AF4:INDEX(AF:AF,MIN(IF(A4:A108="",ROW(A4:A108))))))
I have dropped INDIRECT which is volatile. Above construct is less volatile.
It is ARRAY formula so you need to CTRL+SHIFT+ENTER.
Make sure you replace "," with ";" in formula arguments at your end.
You could follow #shrivallabha redij's suggestion of a custom format or use a TEXT statement like this
=TEXT(MIN(INDIRECT(ADDRESS(ROW(AF4),COLUMN(AF4))&":af"& (MIN(IF(A4:A108="",ROW(A4:A108)))))),"dd.mm.yyyy;;")
EDIT
I agree with #shrivallabha's advice to use Index instead of Indirect. If I was doing this from scratch, I would also use Aggregate:
=IFERROR(AGGREGATE(15,6,AF4:INDEX(AF4:AF108,AGGREGATE(15,6,ROW(A4:A108)/(A4:A108=""),1)),1),"")
Related
I have the following excel function:
OFFSET(Foglio1!C1;S_1x-1;0;E_1x-S_1x+1;1)
If I want to check the returned range during debugging, say e.g. D6:F10, is there a way to explicitly show it?
E_1x and S_1x are user defined names of single cells in the formula above.
I have discovered some indirect ways to check it, but having a method that directly shows me "D6:F10" (in the example above) would be much more practical.
Thanks for the attention.
You can use the following formula to show you the range of that OFFSET() formula in a cell:
=LET(
initial,A1,
row_shift,3,col_shift,4,
height,5,width,8,
range,ADDRESS(ROW(initial)+row_shift,COLUMN(initial)+col_shift)&":"&ADDRESS(ROW(initial)+row_shift+height,COLUMN(initial)+col_shift+width),
range
)
using your starting range "Foglio1!C1" and variable names "S_1x" and "E_1x" that becomes:
=LET(
initial,Foglio1!C1,
row_shift,S_1x-1,col_shift,0,
height,E_1x-S_1x+1,width,1,
range,ADDRESS(ROW(initial)+row_shift,COLUMN(initial)+col_shift)&":"&ADDRESS(ROW(initial)+row_shift+height,COLUMN(initial)+col_shift+width),
range
)
Note 1: Apparently we use different punctuation for formulas. Make sure to use semicolon ; instead of comma , for separation.
Note 2: For this to work, the initial range has to be a single cell and the variables/parameters cannot be error values.
Edit 1:
Without the use of the LET() function the formula can be written as follows, using your starting range "Foglio1!C1" and variable names "S_1x" and "E_1x":
=ADDRESS(ROW(Foglio1!C1)+(S_1x-1),COLUMN(Foglio1!C1)+(0))&":"&ADDRESS(ROW(Foglio1!C1)+(S_1x-1)+(E_1x-S_1x+1),COLUMN(Foglio1!C1)+(0)+(1))
This will show a range with absolute references, i.e. encapsulating the range letters and numbers with $, e.g. $A$2:$M$9.
Combine the above formula with the SUBSTITUTE() function to get rid of the $ symbol by replacing it with an empty string value ("")
I have a range of data. Each cell contains a number and some text like this,
1*100KVA.
Now I want to sum the numbers before * . I have found functions like this one:
=SUMPRODUCT(1*(LEFT(V2:V30;FIND("*";V2:V30)-1)))
and this:
=SUMPRODUCT((VALUE(LEFT(V2:V30;FIND("*";V2:V30)-1))))
but they don't work, when there are empty cells in the range.
is there any solution?
try this:
=SUMPRODUCT(IFERROR(VALUE(LEFT(V2:V30;FIND("*";V2:V30)-1));0))
If you do not use Microsoft365 enter the formula with [CTRL]+[SHIFT]+[ENTER]
Here an example for Region A2:A5
A workaround non-array formula
Maybe by adding "0*" behind the data, and the formula become >>
=SUMPRODUCT(0+LEFT(A2:A5&"0*",FIND("*",A2:A5&"0*")-1))
Note : to replace comma with semicolon to suit with your regional setting
Basically, im trying to search if values from column b is contained in cells on column a
I am currently using the formula
=ISNUMBER(SEARCH(B1,$A:$A))
and using it inside a conditional formatting to highlight the cells in column A that contains strings from column B. But it is not highlighting the correct cells
any advice?
Problem is that your ISNUMBER(SEARCH(…. formula is returning an array of values {FALSE;TRUE;FALSE;FALSE;...} one return for each item in within_text. You need to know if any of those items match.
So, with your formula, consider the array formula modification
=OR(ISNUMBER(SEARCH(B1,$A:$A)))
Since this is an array formula, you need to "confirm" it by holding down ctrl + shift while hitting enter. If you do this correctly, Excel will place braces {...} around the formula as observed in the formula bar
If you don't like to use the CSE entry method, you could use this formula which will return zero for no matches, or be non-zero for any matches:
=SUMPRODUCT(-ISNUMBER(SEARCH(B1,$A:$A)))
Excel's SEARCH function is used to find the position of one string within another string. Generally you use it like this:
=SEARCH("String A", "A Longer String Containing String A")
This will return the character index where first string starts within the second string, which in this case would be 28.
What you really need is a VLOOKUP. Since you're doing a textual search (substring), you need your range to be of text type instead of number.
You should do the following:
Add an extra column to the right of Column A and use TEXT function to convert entries to textual form:
=TEXT(A1, "#")
Now you can use VLOOKUP to perform a substring-match in this textual range. VLOOKUP supports wildcards when you do not ask it to perform an exact match (4th argument should be FALSE). Here is your formula then:
=VLOOKUP("*" & C1 & "*",$B:$B,1,FALSE)
Note that I have passed column B (textual column) as the lookup range, whereas C1 is the cell containing the text that you want to search.
This method also has the additional advantage that it returns the actual matched entry from the range so you don't have to find it manually.
Once you have your results, you can apply conditional formatting to it.
Highlight column A (or the relevant range in column A starting cell A1) with the first cell (which is A1 in this case) as the active cell, use the following formula as the conditional formatting rule:
=(SEARCH($B1,$A1)*(LEN($B1)>0))>0
The logic is to first search the given sub-string from the main string, then multiple the result by LEN($B1)>0 to exclude the result of 1 returned for blank cells in column B.
Note: Conditional Formatting works in array fashion so even though the formula only looks at values in the first row of the range, as long as you use the relative (or in some cases absolute) cell references correctly and highlight the result range correctly before setting up the rule, the rule will be applied across in the same way as for the first row of the array as demonstrated in this example.
=ADDRESS(3,1) 'evaluates to $A$3
=ROW($A$3) 'evaluates to 3
Why can't I nest them?
=ROW(ADDRESS(3,1)) 'Gives an error.
Try:
=ROW(INDIRECT(ADDRESS(3,1)))
instead of using ADDRESS which returns a string, consider using INDEX which will return a cell reference. The general format of INDEX is:
INDEX(Range you want to look in, rows down from top row, columns right for first column)
so in order to reference your whole sheet like address would you would need to select the range of the entire sheet:
=INDEX($A$1:$XFD$1048576,3,1)
The above formula actually returns the cell reference of $A$3 ($ is due to 3 and 1 being hard coded) then turns around and displays the contents of $A$3. As a result you don't actually see the $A$3. On the interesting side of things it also means you can define a range with INDEX(...):INDEX(...). To finish off your formula you would nest the INDEX in your ROW function as follows:
=ROW(INDEX($A$1:$XFD$1048576,3,1))
This avoids the use of the volatile function of INDIRECT and some of its other restrictions.
I have searched the Net and tried multiple solution which never worked. You are my last hope.
I have a table like that:
NAMES.......... VALUES
A...........................4
A...........................1
B...........................4
B...........................3
B...........................2
B...........................1
C...........................4
C...........................3
As you can see, the first column has names only where the second one values.
Both Names and Values often repeat them self.
The idea is to TAG the names (first column) with the MIN value taken from the second column.
So the correct result should be:
NAMES.......... VALUES
A...........................1
B...........................1
C...........................3
I am trying to do that through Excel using the INDEX+Match formula where I am trying to add a MIN formula without success:
=MIN(INDEX($D$25:$D$36,MATCH(C25,$C$25:$C$36,0),1))
I have put the MIN everywhere but none seems to work. Which is the correct syntax and if this is not the right solution, which formula might do the job?
Thank you for your time and help
With data in column A and B, in C1 through C3 enter:ABC then in D1 enter the array formula:
=MIN(IF(A$1:A$100=C1,B$1:B$100,""))
and copy down:
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.
If the data never changes, a Pivot Table is easier to implement.
Two non-array alternatives.
With the newer MINIFS function.
=minifs(d:d, c:c, c25)
Using INDEX in its array format but entered as a standard formula,
=min(index((d$25:d$36)+(c$25:c$36<>c25)*1e99, , ))