# Index and Match formula

#### Newb10

##### New Member
Hello,

I have 2 problems that I am trying to solved. I did my best to search forums but I just cannot seem to find answers (Probably I am not able to interpret the issue properly, been learning excel for more than a month now)

1. trying to use =INDEX(\$B\$6:\$AE\$57,MATCH(\$A66,\$A\$6:\$A\$57,0),MATCH(C\$65,B5:\$AE\$5,0)) to identify the login time of an ID on a certain date. But it returned #N/A most likely because of a formatting issue. I am getting the data from a Pivot table.

2. I have tried to copy the Pivot table to another sheet to remove the formatting, then converted the decimals to time. The formula above worked, but some values shows 12:00:00AM even though some of the cells on the reference table doesn't have any values.

I wanted to show it using attachments but it seems that I am not allowed to.

Thanks!

#### steve the fish

##### Well-known Member
Hi. Number 1 would require more info. If a match doesnt find a match then the result is #N/A. You havent given much away in terms of why that may be. Number 2 probablt means the index match match produces a blank cell which to excel is 0. 0 formatted as time is what you are seeing. For the 2nd one you can do this to produce a blank instead of 0.

=IF(INDEX(\$B\$6:\$AE\$57,MATCH(\$A66,\$A\$6:\$A\$57,0),MATCH(C\$65,B5:\$AE\$5,0))="","",INDEX(\$B\$6:\$AE\$57,MATCH(\$A66,\$A\$6:\$A\$57,0),MATCH(C\$65,B5:\$AE\$5,0)))

#### jasonb75

##### Well-known Member
Welcome to MrExcel!

Trying to follow what you're doing with your first question, I would suggest a slight change to the match for the date and time, assuming that the first macth in your formula is the date, try changing that part to

MATCH(\$A66+1,\$A\$6:\$A\$57,1)

This should work as needed as long as your data is in chronological order, but without seeing a sample of the format it is impossible to say for certain.

For your second question, empty cells are evaluated as zero by most formulas, which is the time value for midnight. A way to get around it would be to check if the original cell is empty, for example

=IF(INDEX(....)="","",INDEX(....))

Simply replace INDEX(....) with your existing formula. This should work with most formulas, not just index.

#### Newb10

##### New Member
wow! Thank you for all your help. Never would have thought that this will be answered even without me posting the screenshot. Many thanks guys! this really help

1,081,676
Messages
5,360,441
Members
400,586
Latest member
Minty

### This Week's Hot Topics

• VBA (Userform)
Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
• List box that changes fill color
Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
• Remove duplicates and retain one. Cross-linked cases
Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
• VBA Copy and Paste With Duplicates
Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
• Macro
is it possible for a macro to run if the active cell value is different to the value above it
• IF DATE and TIME
I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...