Substitute text in a formula for text from a cell - excel

I am trying to substitute a specific part of a formula for the text contained in a different Cell.
The formula is:
=SUMIFS(Data!$C$2:$C$300000,Data!$O$2:$O$300000,"c285",Data!$G$2:$G$300000,">"&DATE(2017,1,1))
This formula is the same all the way down my spreadsheet although it should only be in cell O1. I want to change the part of the formula that says "c285" to match the value in the cell in each row
Is there a way to do this without me doing it manually?
The forumula can be seen in all the cells in Column O, they are all the same as they all have the same formula at the moment

Route 1:if you want to do it programmatically -> take a net language of your choice
take the cell content, search for the position of C1, change that to C +iterator
save it to the cell
Route 2: change the first few cells, delete the rest. Select all the correct cells, click on the right corner, pull down till you got all your rows auto completed
(this works for simple formulas, dates and so on. You would have to test this)
And always have a backup copy

Related

custom format cell in excel

I have a question about custom format cell , Which codes or characters in custom format cell should I use that when I copy a formula from another cell and paste in formatted cell then the result of formatted cell (displayed number) does not change and remain as before pasting?
More explanation
Suppose we have a table where the third column is the product of the first column multiplied by the second.
Then we change one of the cells of the third column using the custom format cell and the character “apple” as follows.
Now if we copy the second row cell of the third column and paste it in the fifth row cell of the third column, the word apple changes to the number 15.
My question is what character instead of “apple “ to use in the custom format cell that does not change the word apple after copying the second row of the third column and pasting in the fifth row of the third column? (for example add the characters "#*., # and etc. with apple may be was the answer
I had two fields with floating point numbers which are divided by each other and the result of the calculation displayed on cell C1. I then copied the same two values down to the second row. I formatted cell C2 to use numeric format with two decimal values only. Lastly, I proceeded to copy the formula on C1 and paste it on cell C2 using "Paste Special --> Formula." You can see the cell format was preserved.
I don't understand this question because it lacks basic context. However, I think I was able to demonstrate that I was able to do what the OP said without "result of formatted cell not changing and remaining as before pasting."
UPDATE:
The example below shows a cell with a custom format of "apple" that formerly contained the formula a*b. After copying the contents of cell B2, I used "Paste Special" to paste the VALUE (nothing else) into cell B5. As you can see in the top-right of the image, the cell contains the value "2" but the custom format of "apple" is preserved.
Obviously, this is not a good example. Suppose that, instead of a custom format of "apple" I format that cell to contain a special format where I want to show a leading zero (if value is single digit) as well as two decimal places. The result is the same. The special formatting is preserved by "specially pasting" something other than the format of the cell.
If I repeat the same process as before, I can paste the value of "2" but it will be presented using the special (custom) format that I had before on the cell, because in Excel, the paste operation copies the value as well as all the metadata of the cell. To avoid this, "PASTE SPECIAL" is the option.
That said, there might be a way of protecting the worksheet to prevent formatting to be overridden in a paste operation. Since I am not an Excel super-user, I don't know if there is a way to lock this information globally. I assume there is a way, but I just don't know it.

how to create an excel formula with vlookup and if argument

I want to create a formula that looks up for a specific text in the range in provide or column and if it finds the text, write that text or the text in the right column in another cell. I am currently using this formula:
=LOOKUP("Haider",O11:O16,E1:E6)
However even when it can not find Haider in the range O11:O16, it still writes the text in the column E1:E6 to the cell in which I wrote the formula.
Also, as there would be only a single word in the entire column at one time, you
could help me with a formula that simply copies that word to a cell of my choice.
Another question is that how can I combine this with conditional formatting? For example, if I want to find the text and if it is found the range I specify, it should turn another cell into red or any color.
The first part of your question is answered in the comment from Byron Wall.
For the second part of the question, if you want to find the first or only cell containing text in a range, the formula is:-
=IFERROR(VLOOKUP("*", O11:O16, 1,FALSE),"")
If you want to find the first or only cell containing anything, the formula is
=IFERROR(INDEX(O11:O16,MATCH(TRUE,O11:O16<>"",0)),"")
but you have to enter it as an array formula using Ctrl-Shift-Enter.
For the last part of the question, supposing you wanted to highlight the cell in E1:E6 corresponding to the cell in O11:O16 containing "Haider", you would need the formula:-
=$O11="Haider"
(this compares E1 with O11, E2 with O12 etc. because of relative addressing)
Highlight E1 to E6.
Go to 'Conditional Formatting'.
Select 'New Rule' and 'Use a formula...' , enter the formula and choose a fill colour in the Format option.

Row Number In Formula Not Counting When I Drag

I have the formula below that I'm using to link to a certain sheet and cell in my workbook that contains a graph for each entry. On the sheet I link too, each graph is about 20 cells down from the previous one. I have over a 100 graphs now and it will grow in time so I was trying to use the HYPERLINK formula rather than the Hyperlink button for this. I thought I would be able to just insert the formula in the first row, paste it in the second row with an added 20 cells, highlight the two and drag it down but it will not count in increments of 20.
Is this even possible?
=HYPERLINK("#'Trends'!A25","Click To View Trend")
I'm thinking you will have to use some type of concatenation to get the behavior you are after. To do this, you may want to employ a "helper" column. For example, put the "numbers" you are after in column B -- below you will see that I incremented it by 5.
Now your HYPERLINK formula in cell A1 is written as:
=HYPERLINK("[Book1]Sheet2!A"& B1,"Click Me for Sheet2, Cell A"&B1)
(Assuming the workbook is called Book1. Now, I can drag that formula down and it will update "dynamically" to account for the changes in column B.

Conditional data entry on certain text in excel

I'm after some pointers.
I want to input text into some cells based on the contents of others.
Current formula that I'm using in cell B1 is
=IF(ISERROR(FIND("example",A1)),"no","yes")
So far, so simple. This works. Inputs 'yes' in B1 if 'example' is located in the cell A1, copy down.
However, there are some cells in the B column which have already been formatted with other text in, and I want to apply this formula on the entire spreadsheet without removing the existing text in column B. So far, the only thing I can think of is by putting this formula in the C column, copying down then moving the text from the C column to the B column - but this requires laborious copy and pasting that kind of negates the time saving provided by the formula.
What is the best way to achieve this? Do I need to resort to VB to scan the entire sheet, iterating through A1-A30000 and inserting the requisite text in B column?
Cheers.
Edit:
So, this has been pretty much sorted, with a variety of suggestions.
However, the actual formula I'm using is:
=IF(ISERROR(FIND("example",A1)),"","yes")
as I only want text to be put in columnB if the pattern is found. This has presented another problem! The double quotes signifying no replacement if the pattern ISN'T found actually inserts a 'NULL' character in there; when you try and select the blank cells on the next iteration of the operation, no cells are selected, as even though there is no visible character, Excel thinks there is. xD
This is solved by writing a macro function to remove Null characters.
Excel is infuriating sometimes. :P
All of the information and advice already given is definitely correct and gets the job done,
byt thought I'd add one that does not require ANY changes to the existing data (eg sorting or filtering):
Put your formula as you described is cell B1. Apply any conditional formatting to that cell, as required.
Now select and copy (ctrl+C) cell B1. Select column B (click on column heading).
Then Click find and Select (binoculars icon) - on Home ribbon tab. Choose go to Special.
In the popup choose Blanks and click ok. You will note all blank cells in colum B are selected. Don’t click anything, press Crtl-V.
Voilà, your formula and conditional formatting is pasted into all blank cells, leaving the rest alone.
Quick keyboard sequence:
select B1
Press ‘Ctrl + C’
Ctrl + ‘Space Bar’
Press ‘Ctrl + G’
Press Tab twice to go to ‘Special…’ button, press Enter
Press ‘K’ for blanks, Press Enter
Press ‘Ctrl + V’
(optional) press escape to remove selection from B1
There are a few ways to deal with this. I'll explain 2 of them :
If sorting is an option, sort your table by column B (ascending / A-Z) to get all the empty values at the top. Write your formula in the first blank cell and extend it by double-clicking the bottom-right corner of that cell.
If you cannot sort, apply filters to the table and select only the blank cells in column B. Then write the formula in the first blank cell and extend it by dragging it down to the last cell.
You might combine your existing B column values with those to be added conditionally in a single formula, say in ColumnC, such as:
=IF(ISBLANK(B1),IF(ISERROR(FIND("example",A1)),"no","yes"),B1)
copied down to suit. Then if ColumnB has become redundant, copy ColumnC, Paste Special, Values over the top and delete ColumnB. The result is to convert the formulae to the results thereof, that may increase processing speed but reduce the ease of handling additional rows (if any) subject to the same requirements.

Excel Conditional Formatting of Dates Automatically

Is there a way for Conditional Formatting in Excel to refer to a whole column from the original reference column?
For example, i want the E column to refer to the C column such that if the dates in the E column are 2 days after the dates in the E column, it will turn green. And i want to be able to do this as fast as possible.
The problem is that right now even if the function would just be the same for the E to C column at each row, i have to do it one by one. Is there anyway to match the whole E column to the C column?
Thanks!
You can use conditional format on the first cell in the column, and use the format painter to copy it to the rest of the column. Use a formula like '=B1=A1+2' as condition for the first cell. Make sure there are no dollarsigns in the formula!
Alternatively, you could use manage rules to apply them to a range. Have a look at the pictures below. I cannot post them here because I have not enough credits yet :-)
http://i.stack.imgur.com/FA3o9.jpg
http://i.stack.imgur.com/qYcvQ.jpg
There is a function called auto fill in Excel. The auto fill function makes it possible to automatically fill in your function in a whole column with just a few clicks.
link to tutorial
Example of auto fill:
Enter 1 in cell A1
Write =(A1+1) in cell A2
Select cell range A2:A10
Click on "Fill" in the ribbon (see image)
Select Down
Now there is numbers 1-10 in columns A1:A10
You may use this feature to add cells with your function in a whole column.

Resources