Text in cell as input, not cell number - excel

I want the text in my cell to be my input for VLOOKUP.
Let's say B3:D10 is written in cell E5.
So, I want to refer to cell E5 and get the range B3:D10, not the value itself.
I used the following formula =VLOOKUP(E4,E5,8,0) but it reads E5 as the table array.
I also tried =VLOOKUP(E4,text(E5,0),8,0) but turns out as #Value! error.

i think you have few mistakes. Range B3:D10 has only 3 columns so you can not set col_index_num to 8 because will cause an error.
See the image please:
E5 - Yellow area is the range B3:D10
E4 the text to search for
G3 hase the below formula:
=VLOOKUP(E4,INDIRECT(E5),2,0)
Tips:
Fix the range you search using "$". Example: $B$3:$D$10
Use IFERROR to avoid error if search value not appear in range
=IFERROR(VLOOKUP(E4,INDIRECT(E5),2,0),"Value not appear in range")

Related

Return the difference, in the first cell, between two cells with a certain value

Goal: Return the date difference shown in cell C5 to cell C4, and the date difference shown in C6 to cell C5 etc.
Currently I am getting the date difference of cells with the letter "s" but it is being shown in the next corresponding row with "s"
Formula currently in C2 then dragged down is as shown below:
=IFERROR(IF(B2="s",A2-INDIRECT("A"&LOOKUP(2,1/($B$1:$B1="s"),ROW($B$1:$B1))),"-"),"n/a")
and this is how my sheet currently looks
Thanks in advance.
The following formula will look for the next "s", as long as it is within 1000 rows of the current one. Put this in C2:
=IF(B2="s",INDEX(A3:A1002,MATCH("s",B3:B1002,0))-A2,"-")
Then populate down
To avoid the last "s" giving a result of #N/A you can wrap the whole thing in an IFERROR statement:
=IFERROR(IF(B2="s",INDEX(A3:A1002,MATCH("s",B3:B1002,0))-A2,"-"),"-")

How to calculate conditional cell formula, with adjacent cell formula dependent on 1st cell's calculated, not printed value?

I am trying to figure an Excel formula and Google is not helping.
I almost have what I am trying to do, but need a 'dummy' column where I do the math in the column cells.
What this means:
1) What I have working:
Cell A1, with math formula (I wish to delete this 'dummy' cell and incorporate this into the formula in Cell B1, see further explanation below)
=SUM((6.75*1)+(5.73*2)+3)
Cell B1, with value from Cell A1 but limited to an integer less than or equal to 80
=IF(SUM(A1)>80, 80, SUM(A1))
Cell C1, with a value looking at Cell B1 and entering in this cell either 0 or any integer greater than 80
=IF(SUM(A1)>80,SUM(A1)-80,"0")
Note: This works perfectly, I change any values in the Cell A1 formula and it correctly reflects in Cells B1 & C1.
2) The missing piece:
I would like to combine the two formulas above in cells A1 & B1 into one cell, and still have the same results described above for each of the cells.
To articulate this another way is:
have a cell with a math formula,
calculate the results of that formula, and then,
enter back in the same cell that formulas results,
with the condition of 'less than or equal to 80'
while a formula in an adjacent cell is dependent on the calculated, but un-printed, value of the first cell.
As an example:
Using only Cells A1 and B1 in a spreadsheet, and combining the above working formulas (which do not work for me in Excel), it would look like this:
Cell A1:
=IF(SUM((6.75*10)+(5.73*7)+8.5)>80, 80, SUM(B21))
Note: Cell A1 formula from above, =SUM((6.75*1)+(5.73*2)+3), combined with Cell B1 formula from above, =IF(SUM(A1)>80, 80, SUM(A1)) (with the Cell A1 formula replacing both 'A1' values in the Cell B1 formula).
Cell B1:
=IF(SUM(A1)>80,SUM(A1)-80,"0")
Note: Identical to the Cell C1 formula above.
Is it possible to do this, calculate the results of a cell's formula, while a formula in an adjacent cell is dependent on the calculated, but un-printed, value of that first cell?
I realize writing this out, it's more complicated than I originally anticipated, which explains why Google wasn't getting me anywhere.
Thanks for any hints.
Phil
Strictly speaking, this is not possible. A cell has only 1 value and that is the result of all calculations. The IF statement is not hiding the value of the cell. It is changing the value.
A formula to another cell can only use the final value of the cell. It can't extract part of the formula in the other cell. There's no way for Excel to know which part to extract, even if there's only a single calculation in an IF statement.
That said, there is a different workaround possible in your case... and that is to change how your value is displayed through custom formatting. Formulas change the value of cells, whereas formatting changes how those values are displayed.
Place your formula in cell A1: =6.75*10+5.73*7+3
Right click on cell A1 and select Format Cells...
Make sure you're on the Number Tab
In the Category column, select Custom
Enter this formula in the Type box: [>80]"80";[<=80]General
Enter this formula in B1:=IF(A1>80,A1-80,0)
Check that the number format of B1 is still "General" or "Number"
The result is A1 has calculated and stored the actual value, but displays the text string "80" if it's value is above 80. You can then use the actual value from A1 in other formulas.
NOTE: This type of custom formatting is extremely poor practice as it can become very confusing and very error prone. The value of the cell is different to what it is showing and if other users are unaware, creating new formulas referring to the affected cell can unwittingly produce incorrect and/or unexpected results.
In particular, Excel tries to be helpful and can automatically copy the formatting from one cell to another if it is next to the original cell or if it refers to only the original cell in a basic formula. Copying and pasting also copies the formatting by default. Unintentionally copying the formatting to other cells will also alter how they appear.
Also note that you don't need to put SUM() around a formula that already had the addition operators included; and Excel uses order of operations so you don't need the brackets to do multiplication before addition.
Lastly, you could also just use =MAX(A1-80,0) in B1.

date formula to return blank if cell is empty

I have the following formula in cell R3. =If(Isblank(E3),"",(E3)+365. This formula gives me the date I am looking for if I have a date entered in cell E3. However cell E3 does not always have a date in it. When there is no date in cell E3 I get #Value in cell R3. Is there a way to leave R3 blank if no date entered in E3.
How about:
=IF(E3="","",E3+365)
Alternately you could wrap your entire formula within an IFERROR() function:
=IFERROR(IF(ISBLANK(E3), "", E3+365), "")
The advantage of this (or disadvantage depending on which way you look at it) is that it will also mitigate any other errors you might encounter from incorrect data types being placed into cell E3, such as #DIV/0, etc.

IF statement in Excel - How to give value to 2 or more cells

If I have a IF statement in one of my cells, for example (this didn't work):
=IF(B6="A10VG 125/32",D4="2.67" & C6="125.0","N/A")
Q: How would I make D4 hold the value "2.67" and the cell C6 hold the value "125.0", IF B6 is equal to "A10VG 125/32"
So if one cell holds a certain condition how can I give different values to a number of different cells?
Excel functions exist to determine the value of the given cell only. Input in, output out. You will need a separate function for each cell.
Excel formulas in a cell can NOT change the values of other cells.
If you want to use formulas, then you will need to put the appropriate formula into the respective cells.
In this scenario, in D4 use the formula
=IF(B6="A10VG 125/32","2.67","N/A")
In C6 use the formula
=IF(B6="A10VG 125/32","125.0","N/A")

Using Wildcard in If Statement with Cell Reference

I'm building a worksheet that will concatenate cells based off of criteria in another column on the same row. After much searching I found Harlan Groves aconcat UDF and this is the formula I've got so far:
=SUBSTITUTE(aconcat(IF(Labor!$A$8:$A$100=A2," "&Labor!$M$8:$M$100," "))," ","",1)
Labor!A8:A100 looks like this:
115012ABCD
115013ZYWX
115014WASD
121018ABCD
121018WASD
Cell A2 = 115
Cell B2 has the formula above.
I'm trying to concatenate a summary of all cells that start with the first three digits of the number in Labor!A8:A100. I've got the formula mostly working but my cell reference (A2) is causing me issues. If I use the exact match (e.g. 115012ABCD) in cell A2, my formula works. Otherwise it returns no data.
How can I tell Excel to find values that start with the digits in cell A2 rather than have to be an exact match with cell A2?

Resources