Usage of INDIRECT excel function - excel

I've got sheet with name April 21 and other sheet with name Summary.
I'd like to prepare cell formula in Summary sheet that will refer to April 21 sheet's cell M10. This works for me just fine, it displays valid value in Summary sheet cell:
='April 21'!$M$10
I try to generify this formula using INDIRECT formula, but it doesn't work at all
=INDIRECT("'" & $D$6 & " " & RIGHT($B$3;3;2) & "'!$M$10")
where D6 contains month name and B3 contains a concrete year, like 2021.
What is wrong with my formula?

You doing wrong in RIGHT() function. Right function has only two parameter. So, it will be like RIGHT($B$3,2). What you write is MID() function format. Try below formula.
=INDIRECT("'" & $D$6 & " " & RIGHT($B$3,2) & "'!$M$10")

If the cell with the year is a date formatted cell then the value will be a float value you take right from.
If that is true then you can use year() to get the year from the date as a string and take right of the string to get 21.
=INDIRECT("'" & $D$6 & " " & RIGHT(YEAR($B$3);2) & "'!$M$10")

If the value in Cell D6 is a date value formatted as month name, then your original formula will not work, and you can try the following:
=INDIRECT("'"&TEXT($D$6;"mmmm")&" "&RIGHT(B3;2)&"'!M10")

Try this:
=INDIRECT("'"&TEXT($D$6,"mmmm")&" "&RIGHT(B3,2)&"'!M10")
Or with your regional settings this becomes:
=INDIRECT("'"&TEXT($D$6;"mmmm")&" "&RIGHT(B3;2)&"'!M10")
These assume:
Your cell containing "April" is formatted as a date, showing only the month name; and
Your cell containing "2021" is either a text string or a number.

Related

Excel: text conversion to date format

I would like to convert text - Apr 7 2017 into date format on Excel spread sheet. Is there a formula that might help with it?
I have already tried format cell into date format but this did not change the cell properties. Thank you for your suggestions
With data in A1, in another cell enter:
=DATEVALUE(LOOKUP(LEFT(A1,3),{"Apr","Aug","Dec","Feb","Jan","Jul","Jun","Mar","May","Nov","Oct","Sep"},{4,8,12,2,1,7,6,3,5,11,10,9}) & MID(SUBSTITUTE(A1," ","/"),4,99))
An alternative:
=DATEVALUE(TRIM(MID(A1,5,2)) & "-" & LEFT(A1,3) & "-" & RIGHT(A1,4))

Excel 'Concatenate' with Alt+Enter, and then reference to another cell

This should be a simple process, but I am having difficulty producing the right outcome. I am trying to combine three cells into one, with Alt + Enter or Char(10) separating each value. When I use a simple Excel formula =B2 & Char(10) & C2 & Char(10) & D2 and wrap the text of the destination cell, everything seems normal. But if I try to search for a string in that cell (for example, "WS001"), it won't find the correct string. If I use VBA to perform the same function (i.e. ThisWorkbook.Worksheets("Sheet1").Cells(2, 1) = Cells(2, 2) & Chr(10) & Cells(2, 3) & Chr(10) & Cells(2, 4)), I can then search for the string in B2 and it fill find it.
That problem was addressed (to a degree), but then when I try to link the destination cell to a cell in a different Worksheet (=Sheet1!A2), I encounter the same issue where the search function can't find the string. Is there another method of doing this (I'd like to avoid VBA, because if someone has to edit the file/information in the future, they might not know how to change it)?
Can you clarify what you are looking for based on this example? Column A is the catenation of the three columns to the right, with CHAR(10).
Would you be for example searching for "Shane"? What result would you want?
EDIT
I'm having trouble understanding what you're looking for, but hopefully this can send you in the right direction.
This is my result:
B1 is the data to be searched for
The catenated formula is as follows: (This also worked when they were on a different sheet)
=C6 & CHAR(10) & D6 & CHAR(10) & E6
The "Catenated result" search formula is an array formula (ControlShiftEnter to enter formula)
="Row "&MATCH(TRUE,ISNUMBER(FIND($B$1,A6:A8)))
The "Individual result" search formula is also an array formula (ControlShiftEnter to enter formula)
="Column "&MAX(($B$1=C6:E8)*COLUMN(C6:E8))-2
(the minus 2 is because the first Source Value" column is column C (ie 3)

Dynamic INDIRECT formula with range

I have some dynamic input, in my case, the name of the month in cell I25. Based on the month the function in cell H32 should reference a sheet with the name of the month and cell A18 within that sheet. Now this I can handle and have made it possible through the INDIRECT function.
The issue I'm having is with dynamic range. For example, I would like cell H33 to reference cell A19 within the worksheet "February". The closest I got to it was =INDIRECT($I$25"&"!A18:A200"). And it seems to be working, but for some strange reason it starts referencing the cells contents from A36 onwards, which I don't get. Suggestions?
Any help would be greatly appreciated.
Use this one in H32 and drag it down:
=INDIRECT("'" & $I$25 & "'!" & CELL("address",A18))
Notes:
I've changed $I$25 & "!" to "'" & $I$25 & "'!" in formula to make it more reliable (for the case when sheet name contains spaces you should include your sheet name in single quotes like this: 'My sheet'!A18)
In H32 this formula evaluates to =Feb!A18 (where Feb is your sheet name), in H33 to =Feb!A19 and so on.

this row number placeholder excel formula

So I am writing some formulas for my spreadsheets and wondered if there was a placeholder for this row number.
For example say I am using the formula:
=C4+SUM(F4:N4)
I know I can autofill this, but what I really want is some stock formula like:
=C{this.row}+SUM(F{this.row}:N{this.row})
Is this possible? Thanks
The function you need is INDIRECT(CELL/RANGE as string)
The INDIRECT function takes in a string and uses it to evaluate a cell or range location. This is where you get the flexibility (aka indirection) that you need.
eg your formula would be:
=INDIRECT("C" & ROW()) + SUM(INDIRECT("F" & ROW() & ":N" & ROW()))

How to make a reference to a cell of another sheet, when the sheet name is the value of a cell?

In excel 2007, I have a formula in a cell like the following:
=COUNTIFS('2008-10-31'!$C:$C;">="&'$A7)
Now I want to make the name of the sheet ('2008-10-31') be dependent on the value of some cell (say A1). Something like:
=COUNTIFS(A1!$C:$C;">="&'$A7) // error
Is there is way to do this? Or do I have to write a VBA-Macro for it?
INDIRECT does what you want. Note that if the sheet name has any spaces, you need to put single quotes round it, ie
=COUNTIFS(INDIRECT("'" & A1 & "'!$C:$C"); ">=" & $A7)
You are looking for the INDIRECT worksheet function:
=INDIRECT("SHEET2!A1")
=COUNTIFS(INDIRECT(A1 & "!$C:$C"); ">=" & $A7)
The function turns a string into a real cell reference.

Resources