If and vlookup functions being used together - excel

Can anyone see why this wouldn't work? the vlookup section works fine if I separate it from the if statement.
The only thing I can think of is that it doesn't like the range being used with the if statement, has anyone any other ideas on how to do this?
=IF('3423'!D:D=1,VLOOKUP(MAX('3423'!$A:$A),'3423'!$A1:$AC23,5,FALSE),"")
Thanks
Paula

It wont let me complete it with a single column reference so if I put in cell references D3:D1000 and swap it to an array it displays the correct information

Related

Index/Small with multiple criteria, multiple results, and wild card

I am basing my question on the instructions that I found at this link
on eImagine.
I followed the instructions to return lists based on one criteria item. It worked well. The initial formula is below:
{=IF(ISERROR(INDEX('Data 6.26.18'!$A$2:$AR$6000,SMALL(IF('Data 6.26.18'!$V$2:$V$6000=Summary!$A22,ROW('Data 6.26.18'!$V$2:$V$6000)-1),COLUMN()-3),14)),"",INDEX('Data 6.26.18'!$A$2:$AR$6000,SMALL(IF('Data 6.26.18'!$V$2:$V$6000=Summary!$A22,ROW('Data 6.26.18'!$V$2:$V$6000)-1),COLUMN()-3),14))}
However, when I tried to add a second criteria item, things didn't work as well. I assume that the SMALL function doesn't work well with AND statements, and piling wild card logic on top of that might not help. The formula that I attempted is below:
{=IF(ISERROR(INDEX(Current!$A$2:$AQ$6000,SMALL(IF(AND(Current!$V$2:$V$6000=Summary!$A17,Current!$S$2:$S$6000="*Open/Active*"),ROW(Current!$V$2:$V$6000)-1),COLUMN()-3),14)),"",INDEX(Current!$A$2:$AQ$6000,SMALL(IF(AND(Current!$V$2:$V$6000=Summary!$A17,Current!$S$2:$S$6000="*Open/Active*"),ROW(Current!$V$2:$V$6000)-1),COLUMN()-3),14))}
Can anyone help me understand what I might need to do make this work? For clarity, I pulled these two formulas from different cells that match on different reference cells ($A$17 and $A$22). Otherwise, I am hoping to make the latter input formula work for both cells.
Please let me know if further background on the referenced spreadsheet would help.
You may try to incorporate another IF() within your IF() since AND() doesn't work with arrays. So basically, it would look like:
IF(Current!$V$2:$V$6000=Summary!$A17,IF(Current!$S$2:$S$6000="*Open/Active*",....
Or you could as well try:
IF((Current!$V$2:$V$6000=Summary!$A17)*(Current!$S$2:$S$6000="*Open/Active*"),...
Tested the first one as working, but haven't really tried the second one. It would be great if the second one did work since it's easier to understand.

Netted If Statement

I need a formula to tell me whether a value in a specific cell is within a certain range. The formula below keeps producing the output ">$75" even for numbers below 75K. Can anyone help me out with this? Thanks so much!
=IF(N2>100000,">$100K",IF(99999.99>N2>75000,">75K",IF(74999.99>N2>50000,">$50K",IF(49999.99>N2>30000,">$30K",IF(29999.99>N2>20000,">$20K",IF(19999.99>N2>10000,">$10K","<$10K"))))))
Excel does not allow the 99999.99>N2>75000 It would be AND(99999.99>N2, N2>75000)
But you can simplify this to:
=INDEX({"<$10K",">$10k",">$20K",">$30K",">$50k",">$75k",">$100k"},MATCH(N2,{0,10000,20000,30000,50000,75000,100000}))
If you really want the IF, then realize that IF resolves in order and the AND talked about above is not needed.
=IF(N2>100000,">$100K",IF(N2>75000,">75K",IF(N2>50000,">$50K",IF(N2>30000,">$30K",IF(N2>20000,">$20K",IF(N2>10000,">$10K","<$10K"))))))
If you have Office 365 you can use IFS():
=IFS(N2>100000,">$100K",N2>75000,">75K",N2>50000,">$50K",N2>30000,">$30K",N2>20000,">$20K",N2>10000,">$10K",N2<=10000,"<$10K")

Nested if/then statement syntax

I've been reading a bunch of answers around nesting if/then statements in Excel but I can't figure out how to fix a "formula parse error" in mine. From what I can tell and in my code editor the formula is correct. Any ideas what I'm missing here?
I have a row of cells that auto-generate a number 1-35 based on other values. I want the cell with the formula to pull data from another row based on what's the in row of numbers 1-35. It works when I test one at a time; it's the nesting that is causing the errors. Thanks!
=IF(E$167=1,C56,IF(E$167=2,D56,IF(E$167=3,E56,IF(E$167=4,F56,IF(E$167=5,G56,IF(E$167=6,H56,IF(E$167=7,I56,IF(E$167=8,J56,IF(E$167=9,K56,IF(E$167=10,L56,IF(E$167=11,M56,IF(E$167=12,N56,IF(E$167=13,O56,IF(E$167=14,P56,IF(E$167=15,Q56,IF(E$167=16,R56,IF(E$167=17,S56,IF(E$167=18,T56,IF(E$167=19,U56,IF(E$167=20,V56,IF(E$167=21,W56,IF(E$167=22,X56,IF(E$167=23,Y56,IF(E$167=24,Z56,IF(E$167=25,AA56,IF(E$167=26,AB56,IF(E$167=27,AC56,IF(E$167=28,AD56,IF(E$167=29,AE56,IF(E$167=30,AF56,IF(E$167=31,AG56,IF(E$167=32,AH56,IF(E$167=33,AI56,IF(E$167=34,AJ56,IF(E$167=35,AK56,””)))))))))))))))))))))))))))))))))))
You might have run into a function nesting limit. Try the choose function to work around it.
How about using
=IF(AND(E167>0,E167<36),OFFSET(B56,0,E167),"")
Note : OFFSET is a volatile function, see this for details.
A simple vlookup or hlookup function can do exactly what you need without righting long nested if statement.
for example you can use:
=vlookup(E$167,$A1:$B35,2,false) where $A1:$B35 is the table array containing column A (1-35) and column B its corresponding value.

Enhanced VLOOKUP formula

I have the following sheet structure:
What I need to find out is, whether code 8101-1101 contains any Matching Projects (in our case 9500-1100). I have tried VLOOKUP formula, however that only works if the matching project is set to the very first item. If matching project exists only somewhere in the middle, then the formula fails. I have also tried SUMIF yet with no luck.
What formula do I need to use, to check this particular example?
As we discussed in the comments, the easiest way to accomplish what you're looking to do would be using the COUNTIFS() function.
Given your example, your final formula would be as follows:
=COUNTIFS(B:B,B2,I:I,"<>")
Good luck and glad it ended up working for you!!

Dynamically Adding Parameters to CountIfs in VBA

I'd like to use countifs in VBA without knowing the amount of criteria/ranges. So in the example below, my script would see that there were 2 criterias, and apply 2 sets of criteria/ranges.
How do I do this in VBA, I can do everything apart from put it in the countifs formula. I tried putting it in a string/variant, ie: Application.Worksheetfunctions.Countifs(stringvariable) but it has not worked, I understand why it has not worked but I can't find a way to do this.
Thanks in Advance for your help.
1) Create the formula as a string
2) Use application.evaluate(var) to get the result

Resources