Working in Excel 2019. In the same realm as one of my previous questions, I'm working with a database that I'm trying to look through via functions to get my values. The VLOOKUP tool worked well for going through the time-table to find the value I need, but it's not working when I'm trying to find RPM as the look-up value. Here's the gist of the data.
We have Time(sec, A:A in "PPT_156Data" sheet), RPM (B:B in same sheet), and Pressure (Bar, C:C in same sheet).
From the graph, you can see that we ramp to 8000RPM over the course of around 60 seconds, and then ramp down to 0RPM over the next 30. Test times WILL vary and rates WILL vary from pump-to-pump, as each one will give different data values based on the pump. That's why, say, 1000RPM will not be in the same spot every time.
I'm trying to find the RPM at 1000 intervals up to 8000 and report out the pressure at said intervals.
Here's what I tried so far, with imagery as well.
'Disregard if you see W25 for S25, I had just been trying multiple things
First, I attempted the same VLOOKUP code I had done for the time-table prior
=VLOOKUP(S25,PPT156_Data!B:C,2,TRUE) 'S25 being lookup value
This worked fine, UP UNTIL it hit a particular spot. For some reason, as soon as it tries to find an approximate match for 6663RPM, it faults out and gives incorrect data. From then on, all the way to 8000RPM, it will ONLY give the result of 0.139BAR. I have no clue why. Trying to find that value in the return array gives multiple results, but it's not like it's the ONLY value left.
So, I tried to do a wildcard for it with the following code
=VLOOKUP("*"&S25&"*",PPT156_Data!B:C,2,FALSE) 'Attempted both False and True states
Gave N/A for both of the values. Not sure if I'm entering in the wildcard incorrectly here. The decimal places that the RPM can go to ranges between 2-5 (hundredths to hundred-thousandths, IE 7000.00750)
I then thought maybe an Index Match would work.
=INDEX(PPT156_Data!B:C,MATCH(S25,PPT156_Data!B:B,-1),2)
Tried that in wildcard format too, returned nothing. So, I decided to see if I could even match a value for RPM with the following attempts
=MATCH(S25,PPT_Data156!B:B,-1)
This gave nothing. HOWEVER, when setting the match specification to 1, it gives the very last row in the data set. So, I decided to find a value in column B, and attempt to match with it exactly.
=MATCH(7000.07,PPT_Data156!B:B,0)
This also returned nothing. Even though, you can see in my images, that the value is ABSOLUTELY there. SIGFIG shows it's 7000.1 but trust me, it's 7000.07. So that sort of threw me for a loop. Figuring maybe there was a different error and grasping at straws, tried another Index Match formula, this time subtracting the lookup value in an attempt to get it extremely close and absolute value/min it
=INDEX(PPT156_Data!C:C,MATCH(MIN(ABS(PPT156_Data!B:B-S25)),ABS(PPT156_Data!B:B-S25),1))
I'm at a loss. I'm not sure if because the rate ramps up and down, thus not being in ascending order, is causing a problem? I can't change that. I am thinking I may need to create a macro for this in some way? Maybe a helper table? But I can't even FIND the match value to create a helper table. Any help at all would be VERY appreciative.
Thank you for your time looking at my post.
I am presuming that you want the first pressure reading when the RPM hits above each 1000 interval. I got to a solution but feels a bit complex.
=index(C:C,1/max(iferror(1/(row(B:B)*(B:B>E12)),Null)))
Breaking this down, we create a boolean array where the RPM hits above the interval
=B:B>E12
and then we multiple this by the array of the rows of column B
row(B:B)*(B:B>E12)
which gives us an array of the row numbers when the RPM is above E12 but also zero for all the ones that do not.
=iferror(1/(row(B:B)*(B:B>E12)),Null)
We then force an error with the zeros by dividing and replace with null. We get the max since we inverse the row numbers and then inverse again to get the row number back.
=index(C:C,1/max(iferror(1/(row(B:B)*(B:B>E12)),Null)))
[Excel working screenshot][1]
[1]: https://i.stack.imgur.com/uhcaX.png
Since I've exhausted about every resource I could find in regards to this question, I figured it was finally time to ask this community.
I have a very large (15k+ row) dataset that I'm looking to generate a report on giving the top 25 largest values based on one of the columns, HOWEVER, there is additional criteria that needs to be considered other than just the values in one column. I have done this already with less criteria, but adding more is giving me trouble.
My (working) formula for Top N with some criteria:
{=LARGE(IF('IMPORTED DATA'!$X$4:$X$1048576 = IF('Data Cleanup'!$AX$3 = 1, "Gaming Designed", "Not Gaming Designed"), 'IMPORTED DATA'!$BH$4:$BH$1048576), ROW(A2) - ROW(A$1))}
The issue comes when I have another criteria I need to add that uses wildcard characters to distinguish the 'correct' criteria. Here is what I've come up with so far, but this just results in the COUNTIF portion always resulting in true, so not actually applying the added criteria:
{=LARGE(IF(COUNTIF('IMPORTED DATA'!$P$6:$P$1048576, IF('Data Cleanup'!$AX$3 = 1, "?????", "????")) * ('IMPORTED DATA'!$X$6:$X$1048576 = IF('Data Cleanup'!$AX$3 = 1, "Gaming Designed", "Not Gaming Designed")) * ('IMPORTED DATA'!$E$6:$E$1048576 <> "All Other (Suppressed)"), 'IMPORTED DATA'!$BH$6:$BH$1048576), ROW(A2) - ROW(A$1))}
I tried to work-around IF statements not accepting wildcard characters using the COUNTIF method but to no avail.
I understand that this is a bit of a rough question, but I'll do my best to respond to as many questions as I can to help clarify.
A couple more bits of information that may be helpful:
This is entirely based in Excel 2019, I know that FILTER would be an easy solution, but I don't have access to that in this version of excel.
The reason for using wildcards is because it was the easiest way to distinguish between the two categories to sort: above or below 100Hz. Anything under 100Hz will be 4 characters, while anything above will be 5.
I also need other data from the same row as the results, so any methods must be also applicable to MATCH criteria so that I can look up the rest of the data with the same search parameters.
its very hard to understand without seeing the data.
What i understood is that if you make a helper column in the dataset as per the criteria you want that would solve your problem.
at least thats how i am also using.
You need to create a ranking column in the data sheet.
Ranking Formula = =COUNTIFS($M$3:$M$233,">="&M3,$K$3:$K$233,K3)
with thise formula you can add as many as criteria as you want.
Index Formula = =INDEX($K$3:$K$233,MATCH(1,($K$3:$K$233=$B$1)*($N$3:$N$233=A3),0))
you need to change the columns names you want.
no need row() functions just try always to use simple sequence will work
Good luck
Ended up solving this in a very simple method thanks to Scott Craner's comment.
Since wildcards don't work in if statements, using LEN did the trick. Final formula ended up being:
{=LARGE(IF(LEN('IMPORTED DATA'!$P$6:$P$30000)=IF('Data Cleanup'!$AX$3 =1,5,4) * ('IMPORTED DATA'!$X$6:$X$30000 = IF('Data Cleanup'!$AX$3 = 1, "Gaming Designed", "Not Gaming Designed")) * ('IMPORTED DATA'!$E$6:$E$30000 <> "All Other (Suppressed)"), 'IMPORTED DATA'!$BH$6:$BH$30000), ROW(A2) - ROW(A$1))}
Thank you to everyone for your help!
I'm not too sure how to word this problem so, I apologize for the vagueness. Here is what I am trying to do though:
I have a large Excel table with a ton of values, I however, only care about 3 columns. The three columns I have are "Project Name", "Active/Planned", and "Week of Month". Here is an example of some values I would have:
Project Name
Active/Planned
Week of Month
StoreProj
Active
2021-07 Jul-Wk1
SecProj
Planned
2021-07 Jul-Wk2
StoreProj
Active
2021-07 Jul-Wk1
Now, I have used a formula to get the number of projects based on a specific week month and avoiding duplicate values for the project name. The code I used returns an integer of the number of projects. Here is what I used:
=IFERROR(ROWS(UNIQUE(FILTER(Table[Project Name],Table[Week of Month]=2021-07 Jul-Wk1))), 0)
This works as intended. Now the issue I am running into is that I need to filter through these rows as I did previously, but now I need to include the "Active/Planned" column. So, I want to be able to see how many projects I have based off of the week of the month and return a number of projects (excluding duplicate names), but be able to filter through that integer output based off of the active/planned projects. So in a perfect scenario I can choose the week of month and if the project is "Active" or "Planned" and see the amount of projects I have.
This might be an easy fix so I apologize, I am just stumped, any help would be greatly appreciated. Thanks!
Work through that step by step, you've got the FILTER function which is giving data to the UNIQUE function, to the ROWS function, and then your IFERROR. However, the data about whether each line/row is 'Active' or 'planned' isn't passed out beyond the FILTER function, so can't be used by anything further on in the above sequence.
Boring theoretical advice out the way, try this;
=COUNT(IF(UNIQUE(FILTER( Table[[Project Name]:[Active/Planned]], Table[Week of Month] = "2021-07 Jul-wk1"))= "Active", 1))
Explanation:
FILTER(...) outputs records with the relevant date filter, however it outputs Table[[Project Name]:[Active/Planned]] - both columns, to ensure all relevant data is there.
UNIQUE(...) Then narrows that down to unique values, although by this stage I'm not 100% sure you need this.
IF(... = "Active", 1) then replaces the 'Active' outputs with 1s
COUNT() returns the number of cells in the above that contain a number (the 1s from the IF())
Yes, you can't use COUNTIF on arrays (and all except that last bullet point above are outputting arrays not single values) - and no, I didn't know that before attempting to answer this question, found it over at a different question!
I'm trying to created a nested IF statement that says, for example, IF A2 is equal to x, x, x posting codes then pull data from the revenue column, IF A2 is equal to y, y, y posting codes then pull data from Bad Debt column and so on for 6 different possible results. Only 3 of the 6 are VLOOKUPs. The other 3 are just if A2=Z then "1024".
I will copy what code I currently have, but it's not pretty. Any help is appreciated. Thank you.
=IF(G2="100",G2="101",G2="102",G2="105",G2="106",G2="170",G2="171",G2="173",G2="200",G2="210",G2="220",G2="230",G2="250",G2="300",G2="301",G2="302",G2="304",G2="305",G2="306",G2="307",G2="308",G2="309",G2="310",G2="312",G2="313",G2="314",G2="315",G2="316",G2="317",G2="318",G2="319",G2="320",G2="321",G2="322",G2="323",G2="324",G2="325",G2="326",G2="327",G2="328",G2="329",G2="330",G2="331",G2="332",G2="333",G2="334",G2="335",G2="336",G2="337",G2="338",G2="339",G2="340",G2="341",G2="342",G2="343",G2="344",G2="345",G2="346",G2="360",G2="370",G2="372",G2="379",G2="382",G2="383",G2="385",G2="390",G2="402",G2="403",G2="404",G2="405",G2="414",G2="415",G2="416",G2="417",G2="418",G2="419",G2="420",G2="421",G2="425",G2="427",G2="428",G2="429",G2="440",G2="441",G2="442",G2="443",G2="444",G2="445",G2="447",G2="472",G2="477",G2="480",G2="501",G2="600",G2="700",G2="800",G2="900",vlookup('AR Credit'!A2,Guarantors!A:D,3,FALSE),IF(G2="347",G2="384",G2="399",G2="406",G2="499",G2="801",vlookup('AR Credit'!A2,Guarantors!A:D,5,FALSE),IF(G2="348",G2="354",G2="355",G2="357",G2="377",G2="601",vlookup('AR Credit'!A2,Guarantors!A:D,4,FALSE),IF(G2="120",G2="150",G2="151",G2="152",G2="153",G2="154","1051",IF(G2="400","1385",IF(G2="500","2036",IF(G2="172","3783","Null"))))))))
One way of fixing your issue is by using OR, specifically wrapping your cases in it like in this example:
=OR(G2="100",G2="101",G2="102",G2="105")
This will result in TRUE if any of conditions is met, otherwise FALSE.
There are numerous errors with your formula. You could get it working by following Zipa's answer and using the OR function. However, it would be a nightmare to maintain if anything changes in future.
I would recommend creating a look up table for the values and results. It could then be queried like so:
=IF(COUNTIFS($E$2:$E$98,$A2)>0,$E$1,
IF(COUNTIFS($F$2:$F$98,$A2)>0,$F$1,
IF(COUNTIFS($G$2:$G$98,$A2)>0,$G$1,
IF(COUNTIFS($H$2:$H$98,$A2)>0,$H$1,
IF(COUNTIFS($I$2:$I$98,$A2)>0,$I$1,
IF(COUNTIFS($J$2:$J$98,$A2)>0,$J$1,
IF(COUNTIFS($K$2:$K$98,$A2)>0,$K$1,"NULL")
)
)
)
)
)
)
See the image below for illustration:
Where I have put "Opt1", "Opt2" in the results row, you can put your VLOOKUPs (although I would recommend INDEX/MATCH instead) or your hard coded values.
This way, you can easily see (and modify) which group each code is in. Even adding more groups wouldn't be too difficult.
Obviously, you could move the table onto a different sheet if you wished.