Sumproduct And Right Function

srizki

Well-known Member
Joined
Jan 14, 2003
Messages
1,844
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
 
Assuming that the numbers in C7:C1184 are true numerical values and not text values, try...

=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)+0),'[Capital Expenditures & Approvals Report-0308.xls]Capital Approvals'!$N$7:$N$1188)

If the numbers in C7:C1184 are formatted text, remove +0 from the formula.

Hope this helps!
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Thank you Domenic,

I understood now, that is what Sailepty said above, but somewhow I was doing it wrong way.

Thanks to both of you.
 
Upvote 0
I like to ask one more thing, so far my required value was a number, what if I want a sentence, using the same formula, except the last criteria is column say P that resides sentences like, "completed" " under process' etc.
I do not have to use Right Function.

Thanks
 
Upvote 0
To search for a value, let's say E10, within a text string in Column P, try...

=SUMPRODUCT(--('[Capital Expenditures & Approvals Report-0308.xls]Capital Approvals'!$B$7:$B$1188=D10),--ISNUMBER(SEARCH(E10,'[Capital Expenditures & Approvals Report-0308.xls]Capital Approvals'!$P$7:$P$1188)),'[Capital Expenditures & Approvals Report-0308.xls]Capital Approvals'!$N$7:$N$1188)

Hope this helps!
 
Upvote 0
I am sorry; I did not explain correctly, the last part of formula should bring a text. I send to others to give me the status of their projects, they reply by filling column M in this case, saying, “completed”, “estimated completion date September 2009”, etc. etc. I need to bring their comments on my master file based on the two matching. The last part of formula is not working; I need to change it to get the text from column M. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
 
Upvote 0
Still somewhat unclear... Is this what you mean?

=INDEX('[Capital Expenditures & Approvals Report-0308.xls]Capital Approvals'!$M$7:$M$1188,MATCH(1,IF('[Capital Expenditures & Approvals Report-0308.xls]Capital Approvals'!$B$7:$B$1188=D10,IF(ISNUMBER(SEARCH(E10,'[Capital Expenditures & Approvals Report-0308.xls]Capital Approvals'!$P$7:$P$1188)),1)),0))

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!
 
Upvote 0
Thank you Domenic.
Yes this is what I mean, I was trying to use this index and match, but without 1 and 0 at the end.
very appreciated.
 
Last edited:
Upvote 0
You're very welcome! Hopefully I understood correctly...
 
Upvote 0
Yes! you did Domenic. I was not using IF function either. I was trying to use Index and match(1,(.... CSE,
that did not work.

Thanks
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,632
Messages
6,125,909
Members
449,274
Latest member
mrcsbenson

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