## Array Formulas - using 3 columns - 2 to match (type 0) and the third to match based on the nearest value less than. Is it possible?

I have an excel table which I've taken from MS Dynamics Nav.  The columns are:

Column A:  Item Code
Column B:  Cost Type
Column C:  Date
Column D:  Cost

I want to find, for a specific Item Code, and specific Cost type the value of the last cost in the table data

Logically I guess I want it to do is:

Select the Cost
where
Item Code = [item code that I've supplied in a cell] and
Cost Type = [Cost Type that I've supplied in a cell] and
and Date is the max value LESS than or equal to [Date that I've supplied in a cell]

Is this possible?
I'm trying to avoid using pivot-tables on pivot-tables data in order to build up the data.  I can do it that way, and then use Index, but there must be a simpler way, and I can;t suss out how to do it with array formulae

Many thanks in advance

Mike

## Keys to the Problem Array Formulas - using 3 columns - 2 to match (type 0) and the third to match based on the nearest value less than. Is it possible?

Download Error Fixer (Free)

Let's say your data are in A1:D65, with headers in row 1.
Enter the Item Code you're looking for in H1, the Cost Type in H2, and the date in H3.
The following array formula, confirmed with Ctrl+Shift+Enter, will return the maximum date from column C less than or equal to that in H3 for which the Item Code and Cost Type match those in H1 and H2:

=MAX(IF((\$A\$2:\$A\$65=H1)*(\$B\$2:\$B\$65=H2)*(\$C\$2:\$C\$65<=H3),\$C\$2:\$C\$65))

Let's say you place this array formula in H4.
You can then use the following (standard, non-array) formula to retrieve the cost:

=SUMIFS(\$D\$2:\$D\$65,\$A\$2:\$A\$65,H1,\$B\$2:\$B\$65,H2,\$C\$2:\$C\$65,H4)

You could merge these into one array formula, but that would be more difficult to maintain.

## How to Avoid Downloading Malware

Where are you getting the download?

There are malicious people who download valid copies of a popular download, modify the file with malicious software, and then upload the file with the same name. Make sure you are downloading from the developer's web page or a reputable company.

Don't install download manager

Many sites suggest or require you to install an installer or a download manager before allowing you to download a program you may be interested in downloading. These tools almost always cause your computer more problems and may even have malware or other spyware. Avoid any site claiming anything must be installed first before you can continue with your download.

Avoid advertisements on download pages

To help make money and pay for the bandwidth costs of supplying free the software, the final download page may have ads. Watch out for anything that looks like advertisements on the download page. Many advertisers try to trick viewers into clicking an ad with phrases like "Download Now", "Start Download", or "Continue" and that ad may open a separate download.

Cancel or deny any automatic download

Some sites may automatically try start a download or give the appearance that something needs to be installed or updated before the site or video can be seen. Never accept or install anything from any site unless you know what is downloading.

## Another Safe way to Repair the Problem: Array Formulas - using 3 columns - 2 to match (type 0) and the third to match based on the nearest value less than. Is it possible?:

### How to Fix Array Formulas - using 3 columns - 2 to match (type 0) and the third to match based on the nearest value less than. Is it possible? with SmartPCFixer?

1. Click the button to download SmartPCFixer . Install it on your system.  Open it, and it will perform a scan for your computer. The junk files will be shown in the scan result.

2. After the scan is finished, you can see the errors and problems need to be fixed. Click Fix All.

3. The Fixing part is finished, the speed of your computer will be much higher than before and the errors have been removed.

Related: AMD Radeon HD 7800M Win8 not working [Anwsered],I can access the internet, get on facebook and get to hotmail, but I can't play games on facebook and I can't open or respond to my e-mails,I keep getting this Media Player error when I log on my computer. [Anwsered],[Anwsered] System Hanging on shutdown and restart,Unable to get the Vlookup property of the WorksheetFunction class,Solution to Error: Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive.
,Troubleshoot:External Hard Drive not listed in Windows 7 backup wizard Error
,I'm always being signed off so annoying Tech Support
,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.
,Solution to Problem: Referencing data in another file
,Troubleshoot:Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive. Error,External Hard Drive not listed in Windows 7 backup wizard Tech Support,Tech Support: I'm always being signed off so annoying,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.,Referencing data in Access using Excel [Anwsered],Need Best Way To Present Data [Anwsered],Same question but for windows 7 home edition,sometimes fullscreen won't activate [Solved],Solution to Error: We bought a new computer with windows 7 and it is constantly freezing. How do we fix this?,Solution to Error: Windows 8 update crash (2013-07-22)
Read More: How to Fix - Apps wont launch , explorer wont refresh?,Fast Solution to Error: AT1 display driver stops working while watching video,Tech Support: Backup fails in Windows 7 premium, first backup worked, none have worked since. Manufacturer has tried to resolve this issue for a week and a half.,[Solution] Backup to external hard drive failed, then boot manager not found - everything lost!,How to Fix - Asus PC Probe II V1.04.83 error on runing in boot setup?,application not found error,any problems in a team where one has Windows XP and the other has Windows 7?,Application/Object-Defined Error,An Excel formula question where hours are totalled and cumulating,Anyone know the hardware email?