I have the following table in excel:
Col1 Col2 Col3 Col4 Col5 Col6
43401 17 #N/A 17 #N/A 43401
43480 17 #N/A 17 #N/A 43480
44501 #N/A #N/A #N/A #N/A
97590 #N/A #N/A #N/A #N/A
00475 #N/A #N/A 8 #N/A
The formula is supposed to check if any of the cols(1-5) is not #N/A, then fetch corresponding Col1 value, if not put a blank. The formula that am currently using is giving me an error or row 5 as it has the value 8 in there and should give me back the corresponding Col1 value.
This the formula that am currently using:
=IFERROR(IF(G2<>"#N/A",F2,IF(H2<>"#N/A",F2,IF(I2<>"#N/A",F2,IF(J2<>"#N/A",F2,0)))),"")
In this formula above G2 is col2, row1 and F2 is col1, row 2...and so on.
Any help on why its happening?
Try this
=IF(COUNTIF(G2:J2,"#N/A")<4,F2,"")
In your current formula the #N/A leads to error results in the IF statement, and your outer IfError just returns the blank.
Your logic can be expressed differently by counting the NA values. If there are fewer than four, one of them cannot be NA, so then return the value from column F.
This is happening because of "#N/A".
IFERROR function traps and handles errors produced by other formulas or functions so it specifically checks for the following errors: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!.
So Whenever your functions check for "#N/A" to be true it throws an error and print a blank space.
Either change "#N/A" to "N/A" or use formula below
=IF(OR(NOT(ISNA(G2)),NOT(ISNA(H2)),NOT(ISNA(I2)),NOT(ISNA(J2))),F2,0)
It will give you this output
Col1 Col2 Col3 Col4 Col5 Col6
43401 17 #N/A 17 #N/A 43401
43480 17 #N/A 17 #N/A 43480
44501 #N/A #N/A #N/A #N/A 0
97590 #N/A #N/A #N/A #N/A 0
475 #N/A 8 #N/A #N/A 475
Related
I'm trying to get rid of some outliers from my dataset. Below is a section of my dataset.
13284 13285 13293 13294 13297 13301 13304 13309
Sat1 0.6140 #N/A #N/A #N/A #N/A #N/A 0.0635 #N/A
Sat2 #N/A #N/A 0.5820 #N/A #N/A #N/A #N/A #N/A
Here's a graph of the entire dataset so you can see what I'm dealing with.
I want to apply a rule where IF a value in the Sat1 row is less than the last non-#N/A value in the Sat2 row minus that value multiplied by 20% THEN change the Sat1 value to #N/A. So in this example, 0.0635 is way less than 0.5820-(0.5820*0.2) and therefore will be omitted. This would get rid of the first huge dip you see in the graph.
I'm sure an If statement is needed; probably nestled within some other functions but I can't figure out how to deal with the #N/As. The solution needs to be dynamic because I have other datasets (graphs) to filter through too and the #N/As are not always in the same location. Any ideas? Maybe too complicated for Excel?
If your data is as below then -
A B C D E F G H I
#1 13284 13285 13293 13294 13297 13301 13304 13309
#2 Sat1 0.6140 #N/A #N/A #N/A #N/A #N/A 0.0635 #N/A
#3 Sat2 #N/A #N/A 0.5820 #N/A #N/A #N/A #N/A #N/A
You can put below formula starting from column C in row#4 -
=IF(C2>LOOKUP(2,1/(ISNUMBER($A3:B3)),$A3:B3)*0.8,C2,NA())
You can drag this formulla for entire row#4 to derive updated Sat1 row :-)
P.S. - I have converted "Sat2 row minus that value multiplied by 20%" as 80% of Sat2 row.
My table
Id index Col1 col2 col3
a 1 smith
a 2 John
b 1 mark
b 2 kay
b 3 Van
c 1 Par
c 2 Cap
In the Vlookup Table
ID Col1 Col2 Col3
a Smith John
b Mark kay Van
c Par Cap
How do I achieve by doing vlookup by id
I believe this will solve your issue:
This is the formula in cell I2:
=INDEX($C:$C,MATCH($H2,$A:$A,0))
This is the formula in cell J2:
=IF(INDEX($D:$D,MATCH($H2,$A:$A,0))=0,OFFSET(INDEX($D:$D,MATCH($H2,$A:$A,0)),1,0))
This is the formula in cell K2:
=IF(INDEX($E:$E,MATCH($H2,$A:$A,0))=0,OFFSET(INDEX($E:$E,MATCH($H2,$A:$A,0)),2,0))
Hope this helps!
Thanks.
If you want to use vlookup instead of index and match, you could use a helper column:
The formula in cell 1 is:
=B2&C2
The formula in cell H2 is:
=IF(ISERROR(VLOOKUP($H2&RIGHT(I$1,1),$A$2:$C$8,RIGHT(I$1,1),0)),0,VLOOKUP($H2&RIGHT(I$1,1),$A$1:$F$8,RIGHT(I$1,1)+3,0))
To make the formula be the same in all cells in the output table, I have used the rightmost character in the column name as an index. Hard coding this value, or adding a helper row, would make it easier to read.
I'm not so advanced in excel I need help if is it possible to do.
I have an excel with this column:
ID - Value1 - Value2
I need to update the value1 (or value2):
- only if are blank AND only if the row has the same ID
I make an example, I have this table:
ID Value1 Value2
A1 1 100
A2 2
A3 3
A4 1 200
A5 2 250
Iwould like to fill all the empty cell in this way
ID Value1 Value2
A1 1 100 200
A2 2 250
A3 3
A4 1 100 200
A5 2 250
Thank you for any help.
Ok, so your data is a mixture of numbers and texts. You can generate two new columns with the desired values using formulas. Choose two new, adjacent columns, say D and E, and enter this CSE formula in row say in cell D2:
D2:
=IFERROR(IF(ISBLANK(B2),INDEX(B$2:B$99,
MATCH(1,($A$2:$A$99=$A2)*(1-ISBLANK(B$2:B$99)),0)),B2), "")
CtrlShiftEnter
Enter the formula in D2 with CtrlShiftEnter and then copy/paste in the cells of columns D and E (or as I said any two adjacent columns).
I have a summary sheet in a workbook that allows a user to enter in a 3 digit ID and some summary data and a chart populates. In the source data, the ID for the totals row is blank. So, when the lookup value is blank (no 3 digit ID is entered) I expected the Index Match formula to return the values corresponding to a blank cell in the lookup array, but it doesn't. How can I fix this?
Sampling of the data:
ID March April
111 10 15
222 15 10
333 10 10
35 35
Formula used:
=INDEX(B9:B12,MATCH(A1,A9:A12,0))
Where A1 is the lookup value
Say we have data like:
and we want to enter the name in A1 and retrieve the age in B1 and also accommodate the blank in column E.
In B1 enter:
=IF(A1="",INDEX(F:F,MATCH(TRUE,INDEX(ISBLANK(E1:E30),0,0),0)),VLOOKUP(A1,E2:F21,2,FALSE))
You cannot lookup a blank cell. Use IFERROR to find the first blank with AGGREGATE in the target if you receive an #N/A.
=INDEX(B9:B12, iferror(MATCH(A1,A9:A12,0), aggregate(15, 6, row($1:$4)/not(len(A9:A12)), 1)))
row($1:$4) is the position within B9:B12 that you are returning to the INDEX.
As shown in the image in Col2 I need to get the count of not null values in the Col1 before the cell.
For cell B2 there is only one value A hence 1.
For cell B4 it should be 2 as there are 2 values A & C.
Same way for B5, 3 (A,C,D)
Data:
A B
1 Col1 Col2
2 A 1
3
4 C 2
5 D 3
6
7 F 4
I have tried:
B1 Cell = COUNTA(A2:A2)
B2 Cell = COUNTA(A2:A3)
B3 Cell = COUNTA(A2:A4)
However I cannot drag this formula as it will change the cell reference.
Can anyone suggest any way to get this done in a single formula which can be applied to all the cells through out the column.
Try this:
=IF(A2<>"",COUNTA($A$2:A2),"")