I am new to using nested if functions in excel. I would like to find out what the correct functions for my excel spreadsheet.
if the pH is <7.35 and the PaCO2 is >6.00, or if the WOB is documented as a yes. I would like to the cell to return a yes response and if not the cell should return a no response.
if 6 columns in my spreadsheet all have yes responses eg a1,b1,c1,d1,e1,f1, i would like the cell in the 7th column i.e. g1 to return a yes response. however if any cell in a1,b1,c1,d1,e1,f1 has either a no , unknown or blank response , g1 should return a no response.
I would be grateful if someone could help me with this by tomorrow - as it is for a work project. Thank you
Lets assume question 1 in on one sheet and question 2 is on another for sake of example. Simply transpose to your case:
If pH is in column A, PaCO2 is in column B, and WOB is in column C, your formula would look like this =IF(OR(AND(A1<7.35,B1>6),C1="YES"),"YES","NO") and paste this in the desired column on row 1. You can copy this down for all applicable rows.
For your second enquiry, I wouldn't use a nested if statement as it restricts you to only the 6 cells you have listed. The following formula will work for as many cells as you like =IFERROR(INDEX(A1:F1,MATCH("NO",A1:F1,0)),"YES"). In this case, you would simply expand your column set for both instances of A1:F1
The nested If statements would look like this (if you choose to go that direction): =IF(A1="NO","NO",IF(B1="NO","NO",IF(C1="NO","NO",IF(D1="NO","NO",IF(E1="NO","NO",IF(F1="NO","NO","YES"))))))
Related
I am wondering if there is a way to do what I want more automatically, i've been doing it with good old regular copy paste but it's taking a lot of time, I need to take the horizontal data I have currently and put it vertically while keeping the first column for each rows, the first column is my "main" part number and I need to link all the other numbers starting from column B to this main part number, example below,
I sometimes have hundreds of rows and columns to do this for, here is what i'm working with
[1]: https://i.stack.imgur.com/dIyZv.png
And here's what the end result needs to look like;
[2]: https://i.stack.imgur.com/PvxGh.png
Thank you in advance!
It can be achieved either with VBA Code or with formulas. I did it with formulas and will try to show you how below.
I have one sheet with all the data, lets call it Sheet1. It looks like this:
Then, I have another sheet which returns what you want (Sheet2). It looks as follows:
Note that the first two columns are necesary for the formulas to work. The actual result is on Columns C and D.
Now, below are the formulas (or values) you would need to put in Sheet2 to make it work:
Cell A1: 0
Cell B1: 1
Cell A2: IF(B2=1,A1+1,A1)
Cell B2: IF(B1+1=$G$1,1,B1+1)
Cell C1: OFFSET(Sheet1!$A$1,A1,0)
Cell D1: OFFSET(Sheet1!$A$1,A1,B1)
Cell G1: The number of columns in the data on Sheet1
Then, just drag the formulas (not the values in A1, B1), until you have the expected result.
I would suggest you try to implement this simple example first, and then move it to your actual spreadsheet.
Let me know how it goes.
EDIT: Regarding your comment, we could do a trick to make it work for a variable number of columns.
First, lets add some variability to the number of columns in Sheet1. This is how my new Sheet1 looks like:
On Sheet2 I added a formula to count the number of columns per row. See Column F below:
Then, the trick is to change the formulas in Column B in Sheet2:
Before: Cell B2: IF(B1+1=$G$1,1,B1+1)
After: Cell B2: IF(B1+1=OFFSET($F$4,A1,0),1,B1+1)
Note: My formula to count the number of columns per row is:
Cell F4: COUNTA(Sheet1!A1:D1)
Note: Change D1 to the max column in Sheet1. Eg. M1.
Note2: You can get rid of cell G1 now.
Start with column B and everything else becomes a doddle. I only use 1 formula for column B and no more than 1 or 2 for column A (there are 3-4+ methods, no need to duplicate yourself but choose any of them to construct A).
I'm only using 1 formula to make each column. Entire job task done in a minute-5.
Column B. Do this first for all your "column B's":'
=IF(ROW(A1)=1,INDEX(A$1:T$1,INT(((ROW()-20)/20+1-ROW($A$1))/COLUMNS(A$1:T$1))+1,MOD(ROW()-20-ROW($A$1),COLUMNS(A$1:T$1))+1),INDEX(A$1:T$1,INT(((ROW()-20)/20+1-ROW($A$1))/COLUMNS(A$1:T$1))+1,MOD(ROW()-20-ROW($A$1),COLUMNS(A$1:T$1))+1))
So all you have to do is drag down. Change only the row references to refer to your 100's if different rows you need to do this for. 1 minute. Job done
for 30 columns/cells change T to AD, for 200 cells , change T to GR, etc. You can also force it to stop at number of your choice.
If you put it anywhere else, it will still work, but your going to have to jiggy with the math a bit to get it to start from the the first entry in the row ( or the specific Wherever you want). Its up to you.
It acts like a modular clock. Been using it for a few years. Ticker tape. Rolling slabs of concrete laying out for you.
here, this is what I get when I plug it into the first row of any column , referring to a 20 field length header on my sheet.
Etc... It continues forever (or for however long you want it). (and you can change the mod anytime).
The first argument you could change to whatever your requirements are , for instance , if(LEN(F8)<1, or whatever, to Start/"Set the clock."
And For any corresponding ranges (your first column for each) (** Your "Column A's" **):
=IF(LEN(H20)<1,K21,H20)
or you can use this logic. It Becomes elementary.
=IF(J21=K21,J21,J20)
Better if you use this starting from row 2 on each column A: if(and(j1=it's next door neighbour, row(it's next door neighbour cell=1)), it's self j1,.. blah blah blah blah
OR AM I MISSING THE POINT ?
Method for getting column A;
Since you already have B, A becomes a simple trivial matter. Like cell =$fixed$cell , i.e. A1=$B$1 and drag down.
simple. headache over. game over. Its all effortless.
But if you want me to elaborate more ,
method 2 for getting 1st column, column A's;
=IF(LEN(AV1)>1,IF(ROW(AV1)=1,AV1,INDIRECT("Av"&1)),"")
=IF(ROW(B1)=1,B1,INDIRECT("B"&1)) <---- drag down from row 1
Method 1 for getting 1st column;
=IF(LEN(AV1)>1,$AV$1,"") <----- drag down from row 1
Method 3, below was my favourite:
=$B$1 <---- from row1 drag down (where row1 was just = column B, cell b1, a1=b1) easy peasy .
You could always demand a further simplification of M3:
A1=if(len(b1)>1,$b$1,"") <--drag down from b2 (where b1 was already set) *probably best because only returns a value as long as column B is .otherwise returns blank.
It's like handling duplicates by formula. Similar .
there was a method 4 too. bUt its late. (Written # 02:00)
Or did I miss the point? It's easy. Imo
Im only using 2 formulas. 1 for each column you need done . do column B first, and colimn A becomes a matter of fact . A doddle.
method 1 is my new favourite.
Its late, my naighbours have pissed me off again. Pardon my fonts and writing but seriously. didnt expect this. some people need to go to jail.(my naighbours)
So in the end: 1 formula for B. 1 for A (any one of any the 4+ methods. There are more also) , plug in and scroll for all the rows you need this done for . takes you 30 seconds? 5 minutes tops for all your rows.
In my excel column I have values as such:
ID
a
a
a
b
c
c
d
e
I would like to return the count of ids which occur twice or more. In this case answer is 2 (a,c).
Constraints:
No helper cols or one at most(There are a ton of other filters to be added to the countifs which are not relevant to the question,adding helpers would mean 12+ extra columns, one for each month)
2.No VBA ( UDF is ok)
3.Formula result in single cell.
The current formula which I have tried:
=COUNTIFS(F13:F22,COUNTIF(F13:F22,">=2"))
gives me 0.
Thanks in advance.
Hmm with no specific order of values, try:
=SUM(IF(COUNTIF(A2:A9,A2:A9)>1,1/COUNTIF(A2:A9,A2:A9),0))
Enter as array through CtrlShiftEnter
Another variant would be:
=SUMPRODUCT((COUNTIF(A2:A9,A2:A9)>1)/COUNTIF(A2:A9,A2:A9))
With the advantage you won't have to enter as array.
Would you choose to add criteria I believe that the second formula is a bit more userfriendly adding them in, like so (edited your sample data a little to show):
=SUMPRODUCT((B2:B9=1)*(C2:C9="x")*(COUNTIF(A2:A9,A2:A9)>1)/COUNTIF(A2:A9,A2:A9))
I currently have a large nested IF statement that uses a helper cell (C1) to dictate which formula to utilize based on numbers 1,2,3,5 & 6. Specifically, one IF statement within the larger nested IF statement needs to be updated for instances when there is a blank cell in column A. Here is how my workbook is setup:
Data Tab
Bonus Tab
Summary Tab
This is my current formula in Column B:
=IF(Data!$C$1=2,IF(SUM(Bonus!B2:C2)<1,0,1)*Data!$B$3+Data!$B$2)
What I am looking for is when cells in column A are blank, than the corresponding cell in Column B would be 0. Again, the formula above has to remain in the =IF(Data!$C$1=2, format since it is part of a larger nested IF statement.
Answer I am seeking:
Thank you for looking!
Try this:
=IF(Summary!A2="",0,IF(Data!$C$1=2,IF(SUM(Bonus!B2:C2)<1,0,1)*Data!$B$3+Data!$B$2))
How about adding an IF in there like this?
=IF(Data!$C$1=2,
IF(LEN(Summary!A2)>0,1,0)*
(IF(SUM(Bonus!B2:C2)<1,0,1)*Data!$B$3 + Data!$B$2))
or like this
=IF(Data!$C$1=2,
IF(LEN(Summary!A2)>0,
IF(SUM(Bonus!B2:C2)<1,0,1)*Data!$B$3 + Data!$B$,
0))
What about:
=IF(AND($C$1=2,LEN(A2)>0),IF(SUM(Bonus!B2:C2)<1,0,1)*Data!$B$3+Data!$B$2)
I realise this gives you FALSE rather than 0 at the end, but I don't know what the rest of your 7 IF statements look like.
EDIT
Based on #AlexisOlson 's comment:
=1*IF(AND($C$1=2,LEN(A2)>0),IF(SUM(Bonus!B2:C2)<1,0,1)*Data!$B$3+Data!$B$2)
This now returns 0 when Column A is blank, as required.
I want to put 58+2 instead of 60 in Microsoft Excel cells. But, when I do that the cell is not counted for summation or other functions. How do I put 58+2 in a cell and get results?
If I put =58+2 inside the cell, due to AUTOSUM it automatically turns to 60
enter image description here
You can solve this with a couple of helper columns (which you can then hide from view). I'll give you two options/examples
In the example titled 'From helper columns to display' In Columns C & D I keep the raw values of the marks and the bonus. Then in Column A I use the
formula
=C3&"+"&D3
To give my result. In column F I can then calculate totals etc. based on the columns C and D.
In the example titled 'From display to helper columnns' this assumes you already have the data stored as xx+x. In column C I use the formula
=VALUE(LEFT(A7, FIND("+",A7)-1))
And column D
=VALUE(RIGHT(A7, LEN(A7)-FIND("+",A7)))
To get the actual values. I can then again use these columns to calculate my totals etc.
The columns C & D can be hidden for visual purposes. Both of these scenarios will achieve the same result it just depends what the format of your data is currently in as to which one you would use
For any cell you want to calculate instead of hard-code, add an equals sign at the beginning
=58+2
will be evaluated by Excel to be a function rather than text and will evaluate it.
I'm working on a budget for a project with multiple phases. There is a possibility that not all phases will be worked on so I've added some lookups and SUMIF formulas so that I can get a summary of my included and excluded effort and dollar amounts. That all works fine. Now I'd like to hide my row of lookups (row 1), but still have a way of identifying which phases of the project are included and which are excluded. Obviously I could manually concatenate them together, but if the phases being included/excluded change then I need to remember to update those formulas (and it's not nearly as fun as doing all in a formula). Here's how my sheet looks:
The TEXTJOIN function seems like it should work (i.e. =TEXTJOIN(CHAR(10), TRUE, C2:N2)), but I can't wrap my head around how to make the range parameter dependent on my lookup row. I played around with INDEX using something like =TEXTJOIN(CHAR(10), TRUE, INDEX(A2:M2,,(A1:M1="Yes")*COLUMN(A1:M1))), but didn't have any luck. At the end of the day I want to have something like:
Phase 1 Phase 2 Phase 5
Please note that the above data should all appear in the same cell - using the line feed character, CHAR(10), as the delimiter in the TEXTJOIN function will make all of the phases appear on a new line within a single cell. I do not want to fill formulas through multiple cells. Thanks in advance for any help.
Please take a look at the picture. I had a similar issue in the past (and brought it to StackOverflow, at which point I was helped by #ScottCraner, original post here:
Doing an array formula lookup
Basically,
1) You set up the array you are looking through - in my case, its $A$2:$A$6, in your case it will be $B$2:$M$2.
2) You then nest the COUNTIFS function inside of a match function. The function does the following:
A) It checks whether the name of phase X has already shown up in column E when you are copy/pasting down
B) If it has, move on to the next one
C) If it hasn't, output
3) Of note: this is an array formula, so the formula itself is checking through every cell. So it looks at cell A2; if the cell in B2 is "Yes", and "Phase 1" isn't in range in column E, then put in phase 1. Because it is, its there. Then it looks at cell A3; if the cell in B3 is "Yes", the same thing for phase 2. Then it looks at cell A4; because B4 is "No", the *(B2:B6="Yes") will throw an error. and so on
4) Place error catching brackets around the function.
A less elegant way to go about this, which doesn't require array formulas would be to use the secondary column's "Yes/No" as an index. This assumes the value in the secondary column is redundant- and repeating the primary column's "Yes" or "No."
In C1: =CONCATENATE(B1,COUNTIFS($A$1:B1,B1)) -
Repeat relatively for E1, G1, etc.
Somewhere separate (the below formula assumes Row 1 of the same worksheet), you could then use: =IFERROR(INDEX($2:$2,MATCH(CONCATENATE("Yes",ROW()),$1:$1,0)-1),"")
To look up "Yes1", returning "Phase 1" and autofill downward. IFERROR is used here to return blank when you run out of "Yes" results.