Any better way to do this?

Guanjin Peter

Active Member
Joined
May 21, 2008
Messages
429
in each cell =SUMPRODUCT(--(db!$A$2:$A26=$B$1),--(db!$F$2:$F26=C$5),--(db!$G$2:$G26=C$6),--(db!$E$2:$E26=$A7),--(db!$D$2:$D26=$B7),db!$H$2:$H26)

is suppose to return values either 1,2 or 3

if it is 1, the cell value will be KG
if it is 2, the cell value will be BAG
if it is 3, the cell value will be PKT


VLOOKUP WON't work for me because it returns >>><TABLE style="WIDTH: 73pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=97 border=0 x:str><COLGROUP><COL style="WIDTH: 73pt; mso-width-source: userset; mso-width-alt: 3547" width=97><TBODY><TR style="HEIGHT: 19.5pt; mso-height-source: userset" height=26><TD class=xl65 style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; WIDTH: 73pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 19.5pt; BACKGROUND-COLOR: transparent" width=97 height=26 x:err="#NAME?">#NAME?</TD></TR></TBODY></TABLE>
after go to each cell then press 'enter' key then it returns
1(or 2 or 3)

Unless i got a way to refresh the page....any idea guys?
protoV5.xls
IJKL
1uomCodeUom
21KG
32PKT
41KG
53BAG
61KG
72PKT
81KG
93BAG
102PKT
113BAG
122PKT
131KG
142PKT
153BAG
162PKT
172PKT
181KG
192PKT
202PKT
213BAG
221KG
233BAG
242PKT
db
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
yup it works. Thanks!!!! :)

erm hi, can I make it return a blank "", instead of a #value?
 
Last edited:
Upvote 0
You're very welcome. Regarding some of your other recent posts, Peter. I see various questions and it seems the structure of the spreadsheet is leading to a complex solution. Lots of array (SUMPRODUCT) formulas. I have not looked at the details - and am not volunteering to do so - though for sure the task would be an order of magnitude easier if you can improve the set up of the data. And the reports too.

Regards, Fazza
 
Upvote 0
yes.....it's a headache...i'm trying to simplify it now....i'll repost it V5 of the excel once it's done...anyway regarding the #value, is there anyway to force it to display blank?
 
Upvote 0
Hadn't seen that new question, Peter. Thanks for mentioning it.

Why does it return #value? Input should be 1 or 2 or 3.

If not, it depends on what you are doing - there are MANY approaches.

Maybe
Code:
=IF(OR(A1={1,2,3}),CHOOSE(A1,"one","two","three"),"blank")
 
Upvote 0
Was trying:

=IF(CHOOSE(SUMPRODUCT(--(db!$A$2:$A57=$B$1),--(db!$F$2:$F57=E$5),--(db!$G$2:$G57=E$6),--(db!$E$2:$E57=$A7),--(db!$D$2:$D57=$B7),db!$J$2:$J57), "KG","PKT","BAG")="#VALUE!","BLANK","Not Blank")

the value is not NULL, not #VALUE!, Not 0...what on earth?
 
Upvote 0
Maybe best to keep it simpler. One column with the SUMPRODUCT and then the next column with the next step.

I guess you saw the formula I posted..
 
Upvote 0
I wonder how to do it...haha...Thanks for quick response
Using your formula...like this right?


=IF(OR(SUMPRODUCT(--(db!$A$2:$A57=$B$1),--(db!$F$2:$F57=C$5),--(db!$G$2:$G57=C$6),--(db!$E$2:$E57=$A7),--(db!$D$2:$D57=$B7),db!$J$2:$J57)={1,2,3}),CHOOSE(SUMPRODUCT(--(db!$A$2:$A57=$B$1),--(db!$F$2:$F57=C$5),--(db!$G$2:$G57=C$6),--(db!$E$2:$E57=$A7),--(db!$D$2:$D57=$B7),db!$J$2:$J57),"KG","PKT","BAG"),"Blank")
 
Last edited:
Upvote 0
Was trying:

=IF(CHOOSE(SUMPRODUCT(--(db!$A$2:$A57=$B$1),--(db!$F$2:$F57=E$5),--(db!$G$2:$G57=E$6),--(db!$E$2:$E57=$A7),--(db!$D$2:$D57=$B7),db!$J$2:$J57), "KG","PKT","BAG")="#VALUE!","BLANK","Not Blank")

the value is not NULL, not #VALUE!, Not 0...what on earth?

=CHOOSE(SUMPRODUCT(...)+1,"","KG","PKT","BAG")

"" is a blank, which you can replace with "BLANK" if so desired.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,749
Members
448,989
Latest member
mariah3

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