Subbing literal to Row() breaks INDIRECT()? - excel-formula

My document is much like a book where each Sheet is like a page, in fact like a chapter.
At the beginning of the doc I have a page that's similar to a table of contents. So beginning let's say at E10 I have
Topic: Page:
Apple 7
Banana 3
Cherry 2
Each topic refers to a sheet which has the exact same name, and each such page has its Page # stored in the Cell B2. To support automatic self-numbering regardless of sheet reordering, in the above table I have formulae calculate the page #, so where it says "7", the formula is
=INDIRECT($E$10 & ".B2")
So $E$10 gives me "Apple", then I get "Apple.B2" which returns the 7.
But now for Banana, the formula is
=INDIRECT($E$11 & ".B2")
I have to change the 10 to an 11. I want something like this, the same formula for every row:
=INDIRECT( "$E$" & ROW() & ".B2")
I've tried a billion things, but I just can't get it. What's weird is that I can generate "Apple.B2" just fine, but when I pass it to INDIRECT() it breaks. Thx.

You are actually checking two different cells, so each one needs INDIRECT:
=INDIRECT( INDIRECT("$E$" & ROW()) & ".B2")

Related

Any formula for the auto correction of the text and make it proper as per requirement in MS excel

I have a sheet where column 1 is having New House numbers example 1-4-3, however actually i need it as per the following 01-04-003, like wise there are some other cases where 002-01-01 number is there, it should be 02-01-001.
The logic is the first number is only 2 digit number, second one is also the same, where as third one is 3 digit number.
Any formula is there to resolve the errors in the data?
I tryied nothing in this connection.
Example
Depending on your version of Excel:
Formula in B1:
=MAP(A1:A7,LAMBDA(x,TEXTJOIN("-",,TEXT(--TEXTSPLIT(x,"-"),{"00","00","000"}))))
If you don't have access to the newfangled functions like lambda, textjoin and textsplit, you can try this one:
=TEXT(LEFT(A1,FIND("-",A1)-1),"00") & "-" & TEXT(MID(A1,FIND("-",A1,1)+1,FIND("-",A1,FIND("-",A1,1)+1)-FIND("-",A1,1)-1),"00") & "-" & TEXT(MID(A1,FIND("-",A1,FIND("-",A1,1)+1)+1,LEN(A1)),"000")

Inserted formula with cell reference does not recognize new input

I swear this just worked yesterday...
I have a program that creates formulas within certain cells that depend on subsequent data entries into other cells:
Cells(i, 40).Formula = "= (N" & i & ")/AP" & i
So, APi can be input and/or changed after the fact, and the formula should give you the result for whatever value is there. However, I get a #Div/0! error no matter what value is in that cell. When I evaluate the formula (within Excel) and step through the calculations, it shows this (for one particular cell):
= (N64)/AP64 = (47.35)/AP64 = 47.35/AP64 = 47.35/9 = #DIV/0!
So, the formula recognizes that there is a value in the cell AP64, but then does not use it to properly calculate the result.
As I said at the top, this worked as I expected yesterday afternoon when I was testing it. Now that I need other people to start using it, of course, it doesn't. I changed nothing within the program relative to these lines of code.
I apologize if this is answered elsewhere - I really have no idea how to create a search for this type of problem.
Two things to check:
1) Value of the cells used is formatted to a number (i've had #Value based on that a couple times) and
2) verify that modifying the code using fixed references provides the appropriate output ("A16" for some reason wasn't recognized as a cell reference in one I had show up). E.g., "$N" & i & "/$AP" & i
If those both look alright, you might try something like:
.Range(.Cells(3,40),.Cells(lr,40)).Formula = "=$N3/$AP3" 'ensure no random spaces
This should act like a fill-down in which the # 3 is iterated with the same row as the formula.

Removing a Line Feed substring without using vba

I am using a Vlookup to take the content of a cell in another sheet. The problem is that this cell has 2 lines, written by VBA, seperated by chr(10) or vbLF (equivalent of alt+enter to switch lines in a cell). I only want the first line. This is what I have right now (RechercheV is Vlookup in French):
=RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;3;FAUX)
It returns "Transfert1Responsable:IC" (in the target cell, Transfert1 is on the first line, and Responsable:IC is on the next). I want to break at the line change and only retain "Transfert1".
Thanks a lot!
Turns out a line feed is called CHAR(10) in English and CAR(10) in French. So using this: http://www.gcflearnfree.org/excel-tips/how-to-use-excels-vlookup-function
I changed my formula to this:
= GAUCHE(RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;3;FAUX); TROUVE(CAR(10); RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;3;FAUX))-1)
And it worked perfectly!
Source for Char(10): http://blog.contextures.com/archives/2011/08/08/add-line-break-in-excel-formula/
EDIT: The whole goal of this was to add an IF statement that would change the text based on the language as chosen by the user. The language is chosen from a validation list in another sheet (French of English) and the VlookUp looks at column 3 for French version, and column 4 for English version. After adding the IF statement I ended up with this monster (This is aside the question, I'm posting in case anyone want to go further with their VlookUp functions):
=SI(Paramètres!cell_langue="FR"; GAUCHE(RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;3;FAUX); TROUVE(CAR(10); RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;3;FAUX))-1); GAUCHE(RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;4;FAUX); TROUVE(CAR(10); RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;4;FAUX))-1))

Excel Formula finding numbers in column?

I have a column filled with numbers. Some rows have more than one number and are separated by and underscore '_'. I am trying to create a formula that will check to make sure all numbers in a range - say 1 through 300 are in the column. But, everything I come up with is finding the number even if it is in another one. For example, I am searching for 5 which I know is missing, but the row with 251 matches for the 5.
A sample section of the column:
20_21_22_23_30_130_131_185
20_21_22_23_157_185_233_234_245_246
24_40
24_40_41
24_40_343
28_76
28_254_255
30_44_130_131_226_342
30_76_145_193_224
30_130_131_185_226_245_246_317
31_32_33_35_36_43_44_45
31_32_33_35_36_126_127_128_130_131_187_226
I have a couple hundred rows and need to make sure I have all number listed.
Any suggestions would be helpful.
Thanks!
change your formula to instead of looking for number in string to look for "number" as this is your natural delimiter. or if you get your feed your numbers from any other particular column, let say from B2 onwards, change it in formula to "_" & B2 & "_"
EDIT
as pointed out, this solution will miss the numbers if they are they appear first in the cell. two possibilities there, please bear in mind i am not sure on exact formula you use, and the volumne of cells you go through, one option is to feed in the column with preceding "_" and enter formula as array, but this will somewhat slow down the calculation, another solution is to add a formula next to the original range which will be populate with a formula ="_"&B2and populated down and do the search from this column instead

Keyword Searches

I have a project where I am given a large amount of information and a description of what issues I am handling. I would like to create a cell at the end of the row that would return yes or no after it performs a search across a row for a specific keyword or piece of text. I have tried using the if(Search()) function, but it only allows for one cell in the row to be searched for the keyword. This would work, but the Keyword(s) that I'm searching for may appear in different columns of the row. Is there anyway that I can create a formula to search the entire row for specific texts? And if any instance of a list of keywords that I have put into the formula appear, can it result in a customizable text response (Yes or no)?
Thanks.
Say in the first row we want to know if we can find "happiness" anywhere in A1 thru C1. In D1 enter:
=IF(ISERROR(SEARCH("Happiness",A1 & B1 & C1)),"No","Yes")
If you have more cells, just increase the concatenation.
you can use COUNTIF to locate a piece of text -any result greater than 0 means the text has been found
use =COUNTIF(A1:F4,"Your Text") if you have to have a full cell match
use =COUNTIF(A1:F4,"*Your Text*") if you want a partial match (e.g. "Dog" will match "CatDog" and "Dogma")
Wrap this in an IF statement to get your desired response
=IF(COUNTIF(A1:F4,"*" & G1 & "*")>0,"Yes","No")

Resources