VLOOKUP Formula - improvement possible?

tlc53

Active Member
Joined
Jul 26, 2018
Messages
409
Office Version
  1. 365
Platform
  1. Windows
Hi,

This formula works, but I was just wondering if there was a more condensed/better way to write it..

=VLOOKUP("716",BJTABLE,10,FALSE)+VLOOKUP("717",BJTABLE,10,FALSE)+VLOOKUP("718",BJTABLE,10,FALSE)+VLOOKUP("719",BJTABLE,10,FALSE)

Thanks :)
 
That would depend on how your spreadsheet is set up and the specific version of MS Excel you're using. Why don't you fill out your profile & tell us the version of MS Excel you have?
 
Upvote 0
That would depend on how your spreadsheet is set up and the specific version of MS Excel you're using. Why don't you fill out your profile & tell us the version of MS Excel you have?
Done!
 
Upvote 0
Is BJTABLE a named range or an actual Table ?
Does each number only appear once ?
In MS365 (thanks @Burrgogi) you have multiple options here is one:
Put the column references where I have B and A
Excel Formula:
=SUM(SUMIFS($B$1:$B$10,$A$1:$A$10,{716,717,718,719}))
 
Upvote 0
The previous option will sum the values if there are multiple lines meeting the criteria.
I will also pick up both numeric and text values matching the values in the {}

A couple of other options that will only pick up the first match and using the quote marks as you have done will only pick up text values:
Excel Formula:
=SUM(IFERROR(VLOOKUP({"716","717","718","719"},BJTABLE,10,FALSE),0))

Excel Formula:
=SUM(XLOOKUP({"716","717","718","719"},BJTABLE[ID],BJTABLE[Amt],0))
 
Upvote 0
Solution
The previous option will sum the values if there are multiple lines meeting the criteria.
I will also pick up both numeric and text values matching the values in the {}

A couple of other options that will only pick up the first match and using the quote marks as you have done will only pick up text values:
Excel Formula:
=SUM(IFERROR(VLOOKUP({"716","717","718","719"},BJTABLE,10,FALSE),0))

Excel Formula:
=SUM(XLOOKUP({"716","717","718","719"},BJTABLE[ID],BJTABLE[Amt],0))
I tried the first formula and it worked perfectly. Thank you!
That was just what I wanted. Looks much tidier.
 
Upvote 0

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