Please help with formula

ewtodd

New Member
Joined
Apr 21, 2002
Messages
3
Hello, I have been racking my brain. Any help would be greatly appreciated.
I need a formula to caculate the following:
The plus and minus signs are in a1 to a4 cells and I need a5 to calculate a value based on the combinations of these cells. Please see below for the values needed. Thanks for any help you can be.
++++ =1
+++- =2
++-- =3
+--- =4
---- =5
-+++ =6
--++ =7
---+ =8
-++- =9
--+- =10
-+-- =11
+--+ =12
+-++ =13
+-+- =14
++-+ =15
-+-+ =16
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
G'day,

Off the top of my head I'd say use a Vlookup. Basically just make that table of 16 choices somewhere like you listed above then use a formula similar to:

=VLOOKUP(A1&A2&A3&A4,$Y$1:$Z$16,2,0)

(where Y1:Z16 contains your table out of view).

Hope that helps. -maybe someone has a more interesting.

Adam

Adam
 
Upvote 0
..man I can't control my grammar.

that was meant to read..."maybe someone has a more interesting way".

Adam reduntant
 
Upvote 0
Concatenate the 4 signs say in B1
=A1&A2&A3&A4

Use Vlookup: I named the Lookup table rL.

=VLOOKUP(B1,rL,2,0)
 
Upvote 0
On 2002-04-22 15:14, ewtodd wrote:
Hello, I have been racking my brain. Any help would be greatly appreciated.
I need a formula to caculate the following:
The plus and minus signs are in a1 to a4 cells and I need a5 to calculate a value based on the combinations of these cells. Please see below for the values needed. Thanks for any help you can be.
++++ =1
+++- =2
++-- =3
+--- =4
---- =5
-+++ =6
--++ =7
---+ =8
-++- =9
--+- =10
-+-- =11
+--+ =12
+-++ =13
+-+- =14
++-+ =15
-+-+ =16

I'd suggest using a different set of symbols like _ for - and X for +, because they would be easier to enter.

Select all cells with symbols (just the first column), go to the Name Box on the Formula Bar, type SYMS, and hit enter.

Select all cells with symbols and numbers, name the selection ALIST (from Association List) via the Name Box as above.

Enter in A1:A4 range:

{"++++";
"+++-";
"+---";
"----"}

In A5 enter:

=SUMPRODUCT(N(OFFSET(ALIST,MATCH(A1:A4,SYMS,0)-1,1,1,1)))

This gives you a total/sum of A1:A4.

Multiplying 2 terms is easy as in:

=VLOOKUP(B1,ALIST,2,0)*VLOOKUP(C1,ALIST,2,0)

Aladin
This message was edited by Aladin Akyurek on 2002-04-22 15:49
 
Upvote 0
Hi,

I understood the OP to have a single +/- symbol per cell and to figure their "value" as the concatenation like Dave Patton suggests.

Just to see what a mess this is without VBA or a lookup table, the following formula (over 500 characters) does the job.

=IF(AND(A1:A4="+"),1)+IF(AND(A1:A3="+",A4="-"),2)+IF(AND(A1:A2="+",A3:A4="-"),3)+IF(AND(A1="+",A2:A4="-"),4)+IF(AND(A1:A4="-"),5)+IF(AND(A1="-",A2:A4="+"),6)+IF(AND(A1:A2="-",A3:A4="+"),7)+IF(AND(A1:A3="-",A4="+"),8)+IF(AND(A1="-",A4="-",A2:A3="+"),9)+IF(AND(A1:A2="-",A4="-",A3="+"),10)+IF(AND(A1="-",A2="+",A3:A4="-"),11)+IF(AND(A1="+",A4="+",A2:A3="-"),12)+IF(AND(A1="+",A2="-",A3:A4="+"),13)+IF(AND(A1="+",A2="-",A3="+",A4="-"),14)+IF(AND(A1:A2="+",A3="-",A4="+"),15)+IF(AND(A1="-",A2="+",A3="-",A4="+"),16)

It must be array-entered with Ctrl-Shift-Enter rather than just Enter.

BTW, I do *NOT* recommend using this at all. Possibly someone else can determine a pattern which can be pulled from the posted table, but I can't find one I can use.

Bye,
Jay
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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