Excel with Blank cells and a IF/AND statement - excel

I have cells A1-A7 with A1 needing the formula. Cells A2-A7 have dropdown list options of "Y" or "N". What I'm needing is for A1 to remain blank until a "Y/N" option is chosen for cells A2-A7. Once A2-A7 have data (Y or N) I need them to be evaluated so that if there is a "N" in any cell of A2-A7, then A1 will display "N". If no "N" is input in A2-A7, then A1 will display "Y"
The formula I'm currently using in cell A1 is:
=IF(COUNTBLANK(M3:M7)>0,"",(IF(AND(M3="N",M4="N",M5="N",M6="N",M7="N"),"N","Y")))
This formula is keeping the A1 cell blank no matter what is input into A2-A7. Any ideas?

There's several ways to do this, but the one first coming to mind for me is to rewrite the second part of your formula.
Keep this part, to check if you have all of your cells filled out
IF(COUNTBLANK(M3:M7)>0,"",
Then, I'd use the same method for finding out if any of the cells hold the value "N"
IF(COUNTIF(M3:M7,"N")>0;"N";"Y")
This is a personal choice, but I find reading the code is easier if you use versions of the same function like this.
The whole code would then be
IF(COUNTBLANK(M3:M7)>0,"",IF(COUNTIF(M3:M7,"N")>0,"N","Y"))
PS: I saw in the comment someone suggested splitting the original formula up in different cells to figure out where it goes wrong. There's also a built-in function that allows you to calculate a formula step-by-step and see the results. It's called Evaluate Formula and can be found under the Formula section.

Related

I want to copy a formula which ends in a number, but amend the number in the new formula by a fixed value

In Cell F190 I have the following formula: ='[Account 19617768.xlsx]19617768'!$G$1142 (the cell displays the value in 19617768 $G$1142 - (£1609.50)
I can display this formula in Cell J190 with the formula: =FORMULATEXT(F190)
By manipulating FORMULATEXT(F190) (i.e. Using Left(FORMULATEXT(F190),38)&(Right(FORMULATEXT(F190),4)+2), I end up with Cell J190 displaying formula: ='[Account19617768.xlsx]19617768'!$G$1144.
What I need is for Cell J190 NOT to display the formula, but the actual value in Account19617768.xlsx G1144 (£1859.50), and it's the conversion of the formula into the value I don't seem to be able to find an appropriate function
I don't have a problem if I need to use an additional function in another cell to finish off the conversion?
I know this should be easy, but having just been released from hospital, I seem to be having
trouble working the simplest things out
'$' signs in excel formula keep the preceding data static.
In other words. Remove the $ in G$1065.
Now when you drag the formula down the column the Cell number will increase.
If you keep the $ in front of G the column G will never change no matter where the formula is copied.

Excel - Highlight cell which is closer and smaller to a specific value

I would like to highlight a cell which is the closest the a specific value but still lower (below) or equal according to a formula.
For instance, if I have 14 in B4, I would like the cell 13 (or 14) highlighted but not 15 in the range.
The value I need to look for would be in B4 and the range that I must apply the highlight formula to would be L1:L371.
So far, the best result I was able to achieve was with (from what I was able to find using Google or Stackoverflow already existing content):
=SMALL($L1:$L317,COUNTIF($L1:$L371,"<="&$B$4))
Although, not only it selects the value I am looking for, it also selects all the values below.
May someone provide me some help so I can achieve the expected result please?
Thank you for your time and help, it is greatly appreciated.
Based on your description, it seems like you need to find the maximum value of a range (L1:L137) that is less than or equal to an input variable (B4) and highlight that value in the search range. Depending on what version of Excel you have, here's what you need to do:
For Excel 2019 or Excel 365
You can use the MAXIFS function. You would actually put that function in a conditional formatting rule, but more on that in just a second. As a test, put the following code in cell B5:
=MAXIFS($L$1:$L$137,$L$1:$L$137,"<="&$B$4)
The first argument is your "MAX_RANGE", or the range that contains the values you want to find the max of. It is also our "CRITERIA_RANGE", the second argument. The third argument is the criteria itself, which is that the search range must be less than or equal to the value in cell B4. Essentially, we are going through the list and creating a subset of numbers that are less than or equal to our search value, and discarding the rest. I assume you are aware of relative vs. absolute referencing, since you used the "$" anchor in your referenced code. If not, here's a description of the difference.
Now, the result of that formula should be the highest number in the list less than or equal to the search value, but that doesn't highlight it for us in our list. To do this we need conditional formatting. To do this, highlight your data range (L1:L137) and go to the conditional formatting drop down on the home tab of the menu ribbon. Choose "New Rule". On the dialog that pops up, choose, "Use a formula to determine which cells to format". In the formula input box, enter:
=L1=MAXIFS($L$1:$L$137,$L$1:$L$137,"<="&$B$4)
This will compare whether the value in the cell being evaluated (L1, for instance) is equal to the result of that formula we talked about above. Since L1 is only relatively referenced, this formula will work for every cell in the data range.
Now, before you hit "OK" on the dialog, select the Format button. This will allow you to adjust your highlighting and formatting as you desire. Click "OK" on the formatting dialog, then "OK" on the Conditional Formatting Rule dialog. This should now highlight any data cell that is equal specifically to the result of our formula, and not everything that's less than our value.
For Earlier Versions of Excel
The concept is the same in earlier versions of Excel, but unfortunately, the MAXIFS function is not present in these versions. Instead, we must use an array formula. Array formulas are a whole other can of worms, but ExcelJet is an excellent resource. In fact, they talk about this very issue, here.
Unfortunately, we can't put the array formula in the conditional formatting formula like we did above, so we'll need to put this formula on a cell in the worksheet, then the conditional formula should reference that new cell. So in cell B5, if you put:
=MAX(IF(L1:L137=B4,L1:L137)
And then, instead of pressing Enter, you must press Ctl + Shift + Enter
This keyboard combination will tell Excel that you are trying to enter an array formula. If you don't press these keys, then the formula will error. Once you have entered the array formula, if you put your cursor in cell B5, you will see the formula bar at the top has added curly braces ({ , }) around the formula to look like
{=MAX(IF(L1:L137=B4,L1:L137)}
This leads to the same result as above, but is just achieved slightly differently. Now, following the same process described above for conditional formatting, you will simply set the formula to:
=L1=$B$5
And that should be it! Hope this helps!

Copying formula from one row above in excel

I am new to excel and I am hoping if someone could help me with this challenge.
What I am trying to achieve is use a continuation formula from cell above if the cell to the left of current cell is not empty.
As you can see in the attached picture, the formula is copied down the row but the left cell is empty, I only want excel to apply formula if left cell is not empty,
I will really appreciate if you can help me please.
You can use ISBLANK and IF function together to check whether a cell is blank or not and give the value you want.
=IF(ISBLANK(A1), "", <put your original formula here>)
It is checking whether cell A1 is blank, then give nothing if it is true. If it is false (there is something in the cell), it will evaluate 3rd argument. So put your formula there.
You may want to look at some beginners tutorial first so that you can learn more about excel functions systematically.
check
https://support.office.com/en-us/article/IF-function-69aed7c9-4e8a-4755-a9bc-aa8bbff73be2 and
https://support.office.com/en-us/article/IS-functions-0f2d7971-6019-40a0-a171-f2d869135665
to know more the IF adn ISBLANK function
Use =ISBLANK() to reliably test if a cell is actually empty.
The following is a table showing the results of applying various functions to a cell to test if is blank or is empty.
Column H contains the actual values being tested. Column I shows what is actually in the cells in column H. Columns D:G apply various formulas to test the contents of H.
Note that, somewhat a misnomer, =ISBLANK is the reliable way to test for an empty cell. =COUNTBLANK or IF(CELL.Value = "") are good ways to test for a blank cell.
I expanded on the example given by Colin Legg here
I hope i have used the term NullString appropriately,other users please feel free to correct me on that.

How to transpose Columns to rows (with interruptions) in Excel?

Suppose that we have two columns including a million rows
like this:
What is the right formula or VBA to make another arranged table like this?
For a pure Excel solution try this.
First you need to add a helper column. This just returns TRUE on a header row or FALSE otherwise. This isn't strictly necessary, but it will make the rest of the formulas a little simpler. In the sample you provided above, type this into cell C1:
=IF(A1=B1,TRUE,FALSE)
Now enter this is cell D1:
=IF(AND(C1,NOT(C2)),A2,"")
What this does is check if the current row is a header but not the next, and copies the first cell of the next row if it is, or returns a blank string if it isn't.
Each subsequent cell follows the same pattern, but it first checks if the previous cell is blank. Enter this function into cell E1:
=IF(D1="","",IF(AND(C1,NOT(C3)),A3,""))
Now you just need to copy this pattern outfor another 10 cells. Unfortunately copy-and-paste won't work as you need to increment A3 and C3 downwards, while copy-and-paste with increment them to the right. So, from E1, we get:
F1: =IF(E1="","",IF(AND(C1,NOT(C4)),A4,""))
G1: =IF(F1="","",IF(AND(C1,NOT(C5)),A5,""))
.
.
.
O1: =IF(N1="","",IF(AND(C1,NOT(C13)),A13,""))
Now copy those cells to the bottom of the data set and you should get the results you're after. Here's an example:
Note the extra TRUE in cell C21 so that the last calculation terminates correctly.
However, if you really have a million rows in your data set, I would question the wisdom of using Excel at all. Depending on your circumstances and resources, you may be better off keeping the data in a text file and processing it with a proper scripting language.
Problem Solved in excelforum by JohnTopley here:
http://www.excelforum.com/excel-formulas-and-functions/1174447-interrupted-transpose.html

How to make a cell register if there is text in two other cells in Google spreadsheet

I have a spreadsheet (Google spreadsheet) where I register information about employee´s education. In the bottom of each column (every employee is represented by a column) I want the cell to display "Yes" if there is text in two other specified cells. (Not if there is text in only one of them, or none of them.)
I have tried all kinds of combinations using AND and IF and NOTBLANK, but I probably have the wrong syntax, or use the functions wrong.
So what I need help to understand is if there is text in cell B3 and in cell B34, how can I create a formula that displays the text "Yes" in cell B38?
Please try:
=if(and(not(isblank(B3));not(isblank(B34)));"Yes";"No")
This may cover a wider range of possibilities than you require but it is usually easeir to trim back than to expand. For example, If either B3 or B34 is empty, this formula returns No, rather than nothing at all (but the No is not obligatory) and the "text" in B3 and B34 can be either alpha or numeric, or a mixture.
Please try this, it works:
=IF(OR(ISBLANK(B3),ISBLANK(B34),NOT(ISTEXT(B3)),NOT(ISTEXT(B34))),"No","Yes")
Logic:
If any of Cell B3 or B34 is blank or contains Non-Text value is returns "No". It just returns "Yes" only if both the cells have a "Text" value.
More short and powerful Formula as per your requirement is as follows:
=IF(AND(ISTEXT(B3),ISTEXT(B34)),"Yes","No")

Resources