Sumproduct And Right Function

srizki

Well-known Member
Joined
Jan 14, 2003
Messages
1,831
Office Version
  1. 365
Platform
  1. Windows
I trying to match two columns of one table to two column of another in another workbook. One of the columns that needs to be matched has number with other numbers and I need only to match the four numbers at far end, therefore I used this formula.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p> </o:p>
=SUMPRODUCT(--('[Capital Expenditures & Approvals Report-0308.xls]Capital Approvals'!$B$7:$B$1188=D10)*('[Capital Expenditures & Approvals Report-0308.xls]Capital Approvals'!$C$7:$C$1188=RIGHT(B10,4)*'[Capital Expenditures & Approvals Report-0308.xls]Capital Approvals'!$N$7:$N$1188))<o:p></o:p>
<o:p> </o:p>
Explanation, the two sheets are “Capital Expenditure & Approval Report”, and “<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:eek:ffice:smarttags" /><st1:PersonName w:st="on">Ken</st1:PersonName> Report”, my formula is in <st1:PersonName w:st="on">Ken</st1:PersonName> report and the report has number like 18600-1413 and I need to match only 1413. <o:p></o:p>
The formula above works perfectly if I do not have to use =RIGHT function.<o:p></o:p>
<o:p> </o:p>
How can I ammend the formula to work.<o:p></o:p>
<o:p> </o:p>
Thanks.<o:p></o:p>
Sohail
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Before index part,
=LOOKUP(REPT("Z",255),CHOOSE({1,2},""

If you could explain it to me, it would be a great help

Thanks
 
Upvote 0
Since the CHOOSE function has an array of index numbers {1,2} instead of a single index number, it returns an array of values made up of both the first value, which is a null string (""), and the second value, which is the value returned by INDEX/MATCH. This array is passed to the LOOKUP function where it serves as the lookup range. Since the lookup value is REPT("z",255), LOOKUP returns the last text value in the range. Assuming that INDEX/MATCH returns #N/A, here's how the formula is evaluated...

=LOOKUP(REPT("z",255),CHOOSE({1,2},"",INDEX(USER!E2:E11,MATCH(MF!A2&B2,USER!A2:A11&B2:B11,0))))

=LOOKUP(REPT("z",255),CHOOSE({1,2},"",#N/A))

=LOOKUP(REPT("z",255),{"",#N/A})

...which returns "", leaving the cell blank.

Hope this helps!
 
Upvote 0
Yes Domenic,

It is clear to me now, and I learned few new things today.

Thank you again for your help.
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top