Excel conditional that is in the same cell as an input - excel

I am trying to work an excel spread sheet at the moment. Everything is going fine bar for this issue.
I am building a conditional statement and If I create an extra row and place this formula into it works perfectly.
=IF(G2="M","M",IF(G2="m", "M", IF(G2="d", "D", IF(G2="D","D", IF(G2="n", "N", IF(G2="N","N", "O"))))) )
What I would like to do is have the input cell and the result's output in the same cell.
Could anyone give me a quick steer in how to resolve the problem?

You can't do that as your input would overwrite the formula.
VBA is the way to to go if that's what you need.

Hide the column having the formula, and put the value of formula on next column. For example if your complex formula is on K column (let's say K2), you just need to hide K, and put following on L2:
=K2
Or, you may protect the sheet/workbook after protecting the formulas, since your idea is to hide the formulas! Just the "Format Cells" dialog, and see Protection tab. Now, you need to search on how to use it.

Use Data Validation with a DropDown and allow D,M,N,O

Related

Clear Cell contents depend on other cell content

My first post here, maybe someone will be able to help.
I have a large Excel table with data from labs. Some results are below LOD And I need to remove them as I do not need them.
So basically I need to clear data in one cell, say E11, if data in D11 shows "<". Meaning below LOD.
If possible I would like to replace value in E11 with "-".
Is there any one who could help me please.
There are a few ways to go about this and you don't really need VBA.
Without VBA - Create a filter on your results and simply filter away the "<" - you could copy and paste this filtered table to another sheet
You could use a cell formula to help you identify results: =IF(A1="<","",B1) which would look at A1, if A1 was a < then it'd return nothing, otherwise it'll return value in cell B1.
With VBA - you'd basically be applying the same logic, just written in code. If you really want to do this, then look up how to do a loop first and how to use IF logic...
enter image description here
This is the worksheet I work with. I would like to clear all the values where < is next to them. This is just part of much bigger table.

Excel IF multiple columns

Im working with a large excel questionnaire that i would like to simplify the data output for further evaluation.
What I'm trying to make is an IF statement, so that if the X is in fueloil the P coloum will write Fueloil ect..
=IF(K2="X";K1)
However when I'm trying to add another IF statement excel returns VALUE. is IF the right way to go about this or is there another way of doing this?
You don't need IF for this at all. You can use an Index/Match combo formula as demonstrated in the screenshot below. The formula in cell P2 is copied down.
=INDEX($K$1:$O$1,MATCH("x",K2:O2,0))
In words: Find the "x" in the current row and return the value from row 1 of that column.
If your regional settings require semicolons to separate parameters in formulas, please use
=INDEX($K$1:$O$1;MATCH("x";K2:O2;0))

Copying cells from one worksheet to another if a column matches a value

I'm trying to use formula to copy data from one worksheet to another where a column matches a certain value.
To be more specific, I want Working!A2:E100 to contain Data!A2:E100 but only for those rows where Data!C2:100 contains the value "Fixed".
Doing this with leaving blank rows is simple, I just create the formula:
=IF(Data!$C2="Fixed", Data!A2, "")
And copy that formula across all the cells.
But then I thought I'd get clever and have it not copy across blank lines, and entered a maze of unclear excel tutorials and vague error messages.
I've created this formula:
=INDEX(Data!A2:Data!A200, MATCH("Fixed", Data!$C$1:Data!$C$200, 0))
And entered it as an array formula using ctrl shift enter.
However all I get is the contents of Data!A2 repeated over and over in every cell of my spreadsheet.
Does anyone need to know what I need to do to make this work?
This is my attempt at a local prototype following the example in BruceWayne's answer, the results are visible:
As you can see "Row 2" just appears repeatedly in the result column. Excel doesn't seem to have an easy way to see what version it is any more but this seems to be a pretty recent one, it's got the ribbon with the file menu and all menu headings are capitalized.
Here's a formula you can use (note: enter this as an array):
=IFERROR(INDEX(A$1:A$200,SMALL(IF(C$1:C$200="Fixed",ROW(A$1:A$200)-ROW(A$1)+1),ROWS(A$1:A1))),"")
You may need to tweak the ranges, I think I got them to match yours, but again, probably need to tweak. You can then drag this down, and it'll fill in with the values from column A, skipping any blanks.
Edit: Here's a screenshot to (hopefully) help show what I did:
You can edit the ranges, naturally, to be over two sheets.
To clarify, A$1:A$200 is the range of what you want to return (the index). C$1:C$200 is the range that holds "Fixed".

Excel cells don't calculate until I double-click them

I have an excel sheet with three sum functions. The sheet is a template, so the rest of the sheet is blank, except for a couple text descriptions in Column A.
I use an ETL process (Talend Open Studio) to open the worksheet, input some data, append a couple other sheets, and save this different worksheet in a file share.
When I open the worksheet in the file share, the three cells with the sum functions show as zero, but when I double-click the cell, they calculate correctly.
I would like for the cells to show their calculation without me double-clicking them.
The cells are formatted as General, and the Calculation option is set to Automatic. What can I do?
select all, find-replace = with = and excel will see the contents as a formula.
I have seen such problem occurs when exporting data from "NoSQL" databases such MongoDB, etc.
You can insert a column in right side and go to the "Data" tab -> "Text to Columns" option.
Make sure you select appropriate format while separating.
Whatever you want to separate will shift to right side. Now delete this undesired column. You are done.
It is possible that Excel is seeing the cells as Text, despite the fact that you have formatted as General. This can be the case when dealing with data coming from an ERP such as SAP.
Try these two approaches to see if one works:
Approach 1
Transfer your data to another sheet by Copying your data cells and paste special (values) into another sheet
Then copy and paste your formulas into the other sheet and see if that works.
Approach 2:
For all the cells you're having trouble with, enter formula =Value([your cell]) in fresh column
Copy that column and Paste Special Values over it
Point your formulas to this new column
It's hard to reproduce the problem you're having unless you have a datasource that is exhibiting the issue. But one of those approaches may help.
How that idea worked for me:
Assumption: Source Data in Column A2
Data is "$4,238.74 "
In B2 = RIGHT(A2, LEN(A2)-1) to clear the leftmost and stubborn character ("$" that would not clear with find and replace)
In C2 = LEFT(B2, LEN(B2)-1) to clear the rightmost and stubborn character (identified as unicode 160 that would not clear either)
After the above cleaning was done the cells still would not work with something as simple as SUM() without double clicking each cell manually.
Since that is not efficient User6574133's divide by 1 idea was applied:
In D2 = C2/1 this called the stubborn (C2) cell that wouldn't calculate and created workable clean data in D2 that would calculate without having to double click each cell manually.
In a blank column Put divide the same number by 1 (eg = 5.223/1 = 5.223) Problem solved
It could be that you have calculations set to manual instead of automatic. To fix this, go to the Formula tab/Calculation/Calculation Options/tick Automatic.
I fixed mine merely by going to formulas, calculation tab, "calculate now". It woke Excel up.
Actually, go to Formulas, Calculation Options, and you will see it is set to MANUAL, change it to AUTOMATIC. I believe some update must have changed it to Manual.
I solved in a very simple way: try saving the file with OpenOffice.

Excel: Change multiple formulae at once?

I've sorted a chunk of data into sub-totaled fields using the Subtotal tool under the Data tab. However, you are only able to choose one formula to apply.
How can I apply a separate formula to one of the columns based on SUBTOTAL(1,RANGE)? So far I have populated it with Subtotal (9,RANGE), but is there a quicker method to select all of these and change the "9" to a "1"?
Select the column.
Press CTRL+H.
Find What: SUBTOTAL(9
Replace with: SUBTOTAL(1
Click Replace All
Assume your formulae are in the range A1:A5
Open up the VBE by hitting Alt+F11, and enter the following code in a general module of the same workbook
Function GetFormula(Cell As Range) As String
GetFormula = Cell.Formula
End Function
I have got this code from http://dmcritchie.mvps.org/excel/formula.htm
For instructions on how to insert this code in a module, see the 'Where to put the code' section at http://www.cpearson.com/excel/writingfunctionsinvba.aspx
Now, you can extract the formula. Use this formula in a helper column, say column B
=SUBSTITUTE(GetFormula(A1),"(1,","(9,")
Now copy this formula upto where you need, and copy-paste values only back where required.
You can also use this trick to modify any other formulae you need, so I suggest you keep this snippet of code handy :)
Change first or last cell then copy it
select all other cells(you can use Ctrl+Shift+up, down, left or right) then use past special and chose formulas

Resources