How JustAnswer Works:
• Ask an Expert
• Get a Professional Answer
• 100% Satisfaction Guarantee
Ask Jess M. Your Own Question
Jess M., Computer Support Specialist
Category: Microsoft Office
Satisfied Customers: 6873
Experience:  Computer Software Specialist for more than 10 years
49766785
Type Your Microsoft Office Question Here...
Jess M. is online now

# I have a series of 10 cells that use a VLOOKUP statement to

This answer was rated:
I have a series of 10 cells that use a VLOOKUP statement to return a value in each of the ten cells - in another cell within this sheet I am trying to return the most recent value of these ten cells (or the last value listed), the problem is that within the ten cells they are not all filled in - so I am trying a nested IF statement to check the 10th cell and if there is a value then return that value, if no value then check the 9th cell and so on until I find a value and then have it returned. Obviously it is not working!

VLOOKUP statement: =IFERROR(VLOOKUP(\$A4,Array10,12,FALSE),"")

Nested IF statement: =IFERROR(IF(W4,W4,IF(V4,V4,IF(U4,U4,IF(T4,T4,IF(S4,S4,IF(R4,R4,IF(Q4,Q4,IF(P4,P4,IF(O4,O4,IF(N4,N4,"")))))))))),"")
Hi, welcome and thank you for your question. My name is XXXXX XXXXX I am glad to assist you today.

Can you send a sample of your Excel file to me so that I can work on them directly? If this is possible, upload the sample Excel file to http://wikisend.com then give me the 6-digit File ID or download link so that I can get your sample file.

Best regards,
Jess
Customer: replied 4 years ago.

Attachment: 2013-08-26_165720_sample_book.xlsx

I used the paper clip to load the file - hopefully you received it.

The book opens up to the sheet I am working on.

In cell F4 is my IF statement to return the 'most recent' value within the range of 10 cells (N4:W4) checking them in reverse order.

Steve,

I got your file. Please give me a moment to check your requirements.

Jess
Customer: replied 4 years ago.

Hi Jess, are you still working on my problem? I thought this was an easy one for you?

Steve,

I am still working on this. Please give me some time since I am looking for other means to solve the problem without using nested IFs.

Jess
Customer: replied 4 years ago.

OK Thanks!!!! Just checking!

Steve,

There is a cleaner and better approach to this without using nested ifs. But it only works from LEFT to right.

That is, can we list the data in columns N to W in reverse order? That is, column N will be 12 Post 2 while column W will be 9 Pre.

Let me know.
Jess
Customer: replied 4 years ago.

Obviously I can do that but it would not be easy to change at this point and it would not make as much sense to our teachers using the program. If your approach works left to right can it check the 10 cells for the first 'empty cell' and then return the value in the previous cell?

Steve,

Based on your problem description, the reported cell must be the RIGHTMOST cell in the 10-cell range. The approach only works LEFTMOST.

That is, if the 10 cells are filled, cell N will be shown. If cell N is blank, the next NON-empty cell will be displayed. And so on in that pattern.

Jess
Customer: replied 4 years ago.

I am sorry for being a pain again but I really do not want to reverse the order of my cells if at all possible - so I am sure you have already considered this but I am going to ask anyway -

Is there a way to check in a range of 10 cells if a cell is filled (has a value from the VLOOKUP statement) and continue checking for filled cells until it encounters an empty cell, record the 'index' of the empty cell and return the previous cell (index-1)?

Customer: replied 4 years ago.

Hi Jess, obviously you are working on other people's problems as well as mine - just wondering where my problem status is?

Hi Steve,

I am sorry for the late reply. I am still working on this as you really wanted the right-to-left approach. I already have a clean formula but it will only work from left to right.

I will not be using nested ifs, if possible.

Regards,
Jess
Hi Steve,

Thank you for patiently waiting. I have completed it successfully. The formula I used is an array formula, so if you enter an array formula, while the cursor is in the formula bar, press CTRL+SHIFT+Enter instead of just pressing Enter. Doing that appends the curly braces in the formula itself to indicate it is an array.

The formula is:
=INDEX(N4:W4,MATCH(9.99999999999999E+307,N4:W4))

When Ctrl+Shift+Enter is pressed, the formula will become:
{=INDEX(N4:W4,MATCH(9.99999999999999E+307,N4:W4))}

You can then drag the formula down to copy it.

That formula will actually look for the LAST non-blank cell in the row range from left to right, that is exactly what you require.

Here is my sample file:
http://www.filedropper.com/samplebookrev1

That page has a lot of ads, (wikisend.com is down temporarily) click on the gray button that says "Download This File". Enter the captcha code and you shall be able to download my sample Excel file where the formula is already added.

Please remember to rate my service positively (3-5 stars/faces) once you have all the information you need. Tips are always highly appreciated!

If you have any other questions, please ask me or reply to me – I’ll be happy to respond.

Thank you!

Best regards,
Jess
Customer: replied 4 years ago.

That appears to work great for my mile time but it did not work for the other three categories (push ups / sit ups etc.) in my spreadsheet? The other three areas are just numbers no decimal points and no time format - is there a quick adjustment to your formula so that it works on numbers and not a time format?

As always thanks for your time and help.

Hi Steve,

I have completed the formula in the other 3 columns and they just worked just fine. You just need to adjust the range of the columns involved.

Also, I added IFERROR function to avoid the #N/A error when all cells in the row are blank.

For column F:
=IFERROR(INDEX(N4:W4,MATCH(9.99999999999999E+307,N4:W4)),"")

For column H:
=IFERROR(INDEX(X4:AG4,MATCH(9.99999999999999E+307,X4:AG4)),"")

For column J:
=IFERROR(INDEX(AH4:AQ4,MATCH(9.99999999999999E+307,AH4:AQ4)),"")

For column L:
=IFERROR(INDEX(AR4:BA4,MATCH(9.99999999999999E+307,AR4:BA4)),"")

For the modified file, download from this link:
http://wikisend.com/download/737634/sample_book_rev2.xlsx

Please remember to rate my service positively (3-5 stars/faces) once you have all the information you need. Tips are always highly appreciated!

If you have any other questions, please ask me or reply to me – I’ll be happy to respond.

Thank you!

Best regards,
Jess
Customer: replied 4 years ago.

Thanks everything seems to be working just as I needed!!!!

I have just one more HOPEFULLY quick question and if it is not please do not spend any time working on it as I can always work around it.

In column G I am trying to return the BEST mile time so I am using the formula below which works perfect except for when the returned time is 0.00 which of course now becomes the best time - so my question is can we add an IF statement to ignore 0.00 and return the actual lowest time skipping over any 0.00s???

=IFERROR(MIN(\$N6:\$W6),"")

Steve,

Thank you for writing back.

In this case, you can enclose your MIN function with an IF like this:
=IF(MIN(\$N5:\$W5)=0,"",MIN(\$N5:\$W5))

In that case, if the MIN function gives 0:00 since it is indeed the minimum, it will display blank instead of the 0:00 time.

If you still want the IFERROR, the final formula will be:
=IFERROR(IF(MIN(\$N4:\$W4)=0,"",MIN(\$N4:\$W4)),"")

Here is the completed file:
http://wikisend.com/download/252296/sample_book_rev3.xlsx

Please remember to rate my service positively (3-5 stars/faces) once you have all the information you need. Tips are always highly appreciated!

If you have any other questions, please ask me or reply to me – I’ll be happy to respond.

Thank you!

Best regards,
Jess
Customer: replied 4 years ago.

I am so sorry to bother you yet again - it does exactly what you said it would do but that is not what I was hoping for - in other words if the formula encounters a '0' I need that to be ignored and continue checking for the best time that is not '0'. It returns a blank due to the '0' but I need the best time.

I have included a spreadsheet that displays what I am looking for better than the one you have. So B3 is your formula and the range of ten cells M3:V3.

Attachment: 2013-08-27_172543_sample.xlsx

If this new requirement is too much work please disregard as I am sure you have better things to do,

Steve,

Is this referring to another formula in your worksheet already? I was working with the source formula for column G?

Jess
Customer: replied 4 years ago.

No it is a slightly different worksheet that I was experimenting with I just removed the first few rows so B3 is the EXACT same thing as G3 and the range is M3:V3 instead of N3:W3 this sheet just has more data is all.

Sorry for the confusion - sheet 1 actually has the 0.00 (V3) for a mile time that I would like to ignore.

Steve,

I see the problem, this is indeed about the MIN function that you asked about earlier.
In this case, you need another array formula to test the NON-ZERO numbers only, that is, cell values greater than zero.

Here is the array formula in your new file:
=MIN(IF(M3:V3>0,M3:V3))

Here is the modified file with the formula added already:
http://wikisend.com/download/597474/sample_2.xlsx

In cell B3, 5:15 is shown instead of 0:00.

Please remember to rate my service positively (3-5 stars/faces) once you have all the information you need. Tips are always highly appreciated!

If you have any other questions, please ask me or reply to me – I’ll be happy to respond.

Thank you!

Best regards,
Jess
Jess M. and other Microsoft Office Specialists are ready to help you
Customer: replied 4 years ago.

THANKS JESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I will not bother you anymore!!!!!!!

Lol!

No problem Steve... I am glad to be of help. If you need assistance in the future, you can request me any time.

Best regards,
Jess