The calculation in Excel works, but only in a single row

pyclen

Board Regular
Joined
Jan 17, 2022
Messages
85
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi All,

I apologize as this may be a trivial solution however I am stuck with the current solution provided by one of the members of this forum (Thank you again, bebo021999)

The previous thread is here: getting excel to calculate correctly

my problem is that the solution presented only works for a single row (I thought I could adopt to multiple rows, duh)

The formula is N4 works for this particular cell or better the first row (test 1, N4:V4) however it does not work in N5 and below as well as O5 and on.
What needs to happen is that somehow an index/match or lookup needs to be added to the formula in N4 to make it look up what test it is and how many samples there are to make it work

Again, very appreciative of this forum and any/every help received


Example.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAK
2setup hoursreplicate hours
3TestDifficultyGroupSurchargehourly ratesetup hoursreplicate hours#of setupsReplicates# of lots/strengthsOrientationsPackaging ConfigurationsT0T1t2T3T4T5t6t7t8surchargeGrouphr rateTestavghiavghi
4test 1avggrp10%1001111111$200$300$400$500$600$700$800$900$1,0000grp1100test 11111
5test 2avggrp10%1002211111$400$600$800$1,000$1,200$1,400$1,600$1,800$2,0000.1grp2150test 22222
6test 3avggrp10%1003311111$600$900$1,200$1,500$1,800$2,100$2,400$2,700$3,0000.2grp3175test 33333
7test 4avggrp10%1004411111$800$1,200$1,600$2,000$2,400$2,800$3,200$3,600$4,0000.3test 44444
8test 5avggrp10%1005511111$1,000$1,500$2,000$2,500$3,000$3,500$4,000$4,500$5,0000.4test 55555
9
10
11stability timepointsT0T1t2T3T4T5t6t7t8
12test 1123456789
13test 2123456789
14test 3123456789
15test 4123456789
16test 5123456789
Sheet1
Cell Formulas
RangeFormula
F4:F8F4=ROUND(IF(COUNTA($D4:$E4)<2,"",VLOOKUP($D4,$AB$4:$AC$6,2,0)*(1+$E4)),0)
G4:G8G4=IF($B4="","",INDEX(setup,MATCH($B4,test,0),MATCH($C4,Difficulty,0)))
H4:H8H4=IF($B4="","",INDEX(replicate,MATCH($B4,test,0),MATCH($C4,Difficulty,0)))
I4:I8I4=ROUNDUP(PRODUCT($J4:$M4)/10,0)
N4:V8N4=$F4*($G4*ROUNDUP(HLOOKUP(N$3,$C$11:$K$16,2,0)*$J4*$K4*$L4*$M4/10,0)+$H4*HLOOKUP(N$3,$C$11:$K$16,2,0)*$J4*$K4*$L4*$M4)
B12:B16B12=B4
Named Ranges
NameRefers ToCells
Difficulty=Sheet1!$AG$3:$AH$3G4:H8
group=Sheet1!$AB$4:$AB$6F4:F8
rate=Sheet1!$AC$4:$AC$6F4:F8
replicate=Sheet1!$AI$4:$AJ$8H4:H8
setup=Sheet1!$AG$4:$AH$8G4:G8
test=Sheet1!$AF$4:$AF$8G4:H8
Cells with Data Validation
CellAllowCriteria
B4:B8List=test
C4:C8List=Difficulty
D4:D8List=group
E4:E8List=surcharge
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
How about
Excel Formula:
=$F4*($G4*ROUNDUP(SUM(($C$11:$K$11=N$3)*($B$12:$B$16=$B4)*($C$12:$K$16))*$J4*$K4*$L4*$M4/10,0)+$H4*SUM(($C$11:$K$11=N$3)*($B$12:$B$16=$B4)*($C$12:$K$16))*$J4*$K4*$L4*$M4)
 
Upvote 0
Solution
=$F4*($G4*ROUNDUP(SUM(($C$11:$K$11=N$3)*($B$12:$B$16=$B4)*($C$12:$K$16))*$J4*$K4*$L4*$M4/10,0)+$H4*SUM(($C$11:$K$11=N$3)*($B$12:$B$16=$B4)*($C$12:$K$16))*$J4*$K4*$L4*$M4)
Wow, that does the trick as far as I can tell, thank you very much for that quick reply
I am amazed by how quickly someone sees a solution in a formula or how to solve the problem, need to watch a bunch more youtube videos and use other resources to get anywhere near this level

I am just a bit confused about what the bolded part above does but I guess it replaces the HLookup
 
Upvote 0
As that works you can shorten it slightly like
Excel Formula:
=LET(p,SUM(($C$11:$K$11=N$3)*($B$12:$B$16=$B4)*($C$12:$K$16))*$J4*$K4*$L4*$M4,$F4*($G4*ROUNDUP(p/10,0)+$H4*p))

The 1st two part of the sum create an array of True/false which is converted into 1s & 0s That array is then multiplied by the part in bold so you should get a load of 0s with a single number mixed in.
 
Upvote 0
Again, I am amazed at the mastery of formulas
I checked this in the 'evaluate formula' window and yes, at some point it is just a bunch of zeroes with a single number(y)

Thank you again for your help
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
I apologize for messaging you directly however I am running into a snag with your solution

This table was just an example I made up in order to protect the confidentiality however all things work the same way with the exception that the table values in the lower table (c12:k16) are the result of a countA formula. Additionally, my cell references are different, i.e. B12:B16 is B66:B90 in my real table (am not able to share due to confidentiality
reasons)
The formulas work great when I use the first row however once I have a second (or any number of additional) row(s) of tests I get an aggregate value corresponding to the sum of c12:c13 in cell N4, in other words the formula doubles/triples etc the calculated value.

I have checked every line, every cell reference and I am getting the same result.
Any idea why that may occur?

Thank you
 
Upvote 0
Do you have the same test multiple times B66:B90?
 
Upvote 0
It is possible that the same test shows up more than once
 
Upvote 0
That will be the problem. If a test does appear more than once, how would you know which row to use?
 
Upvote 0

Forum statistics

Threads
1,215,225
Messages
6,123,732
Members
449,116
Latest member
Aaagu

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