Need help with a custom formula(s)

Hi, I posted this question months ago and Wayne Costello was nice enough to respond with some suggestions, but I don’t think I explained what I was looking for very well so I’m going to try again here with some ((hopefully) better images.


I’m looking for a Numbers guru to help me with a problem I have…


I use Numbers to create quotes for clients in the Visual Effects business. The final price for any shot is determined by estimating the number of hours to do given tasks like CG LAYOUT, CAM TRACK, etc. (located on left side of these tables) and then multiplying those estimates by relative rates for each task. For this example I am using a rate of $100/hour for each task.


Since many shots are often similar to each other when bidding, I’m looking to generate some “pre-set" entries for the hourly amounts into my PRE-FILL DATA table. That way I can automate the filling in amounts when entering data into my CLIENT DATA table.


In the lower CLIENT DATA table, I am hoping to use a pop-up menu for the Orange DIFFICULTY LEVEL column (C) that ,when selected, will lookup all of the associated entries for that matching row in the PRE-FILL DATA table above and copy the values from specific PRE-FILL table cells into matching cells in the CLIENT DATA table below.


FOR EXAMPLE: In the lower CLIENT DATA table, I want to select the Pop-Up value in Column C called “CG Medium”. I then want to have any values in PRE-FILL DATA table, Row 6 (the "CG Medium" row) copied to their corresponding column in the CLIENT DATA table below.  However, I only want to copy the values from certain columns, specifically any values in the Blue headed columns in the PRE-FILL DATA table should go into the corresponding Yellow headed columns into the CLENT DATA table below.


The Gray headed columns are derived from formulas or specific entry, so I do not want to mess with any values from those.



Any help with a formula(s) would be great!


I hope that makes sense!


MacBook Pro 14″, macOS 13.4

Posted on May 26, 2023 11:52 AM

Reply
Question marked as Best reply

Posted on May 31, 2023 6:19 PM

As long as you are using the same spelling in the Header Rows and Difficulty Level in both tables (it appears that you are) then the formula can handle hidden columns.


So, in troubleshooting, you might try to track down an error in entering the formula.


This is my formula (when copied from A2 to M2):


IFERROR(OFFSET('PRE-FILL DATA'::$A$1,XMATCH($C2,'PRE-FILL DATA'::$C),XMATCH(M$1,'PRE-FILL DATA'::$1:$1)−1),"")



Compare that to yours in your latest screenshot. You will see immediately that they are not the same. Hint: look within the second XMATCH. What happened to M$1?


To make it easier to compare and to understand what is going on, I recommend that you uncheck 'Use header names as labels' at Numbers > Settings (old name Preferences) in your menu.


Also to remove distractions it can help to click the unneeded optional parameter tokens and delete them (although you can leave them if you wish).


Also, when debugging formulas it can be helpful to click a warning triangle and see what the message says. Sometimes it just says syntax error. Sometimes it gives more specific clues as to what is wrong.


My formula does work. It should take just a minute or two to get it working in your table and fill/copy it into other cells.


SG




Similar questions

9 replies
Question marked as Best reply

May 31, 2023 6:19 PM in response to JohnGross

As long as you are using the same spelling in the Header Rows and Difficulty Level in both tables (it appears that you are) then the formula can handle hidden columns.


So, in troubleshooting, you might try to track down an error in entering the formula.


This is my formula (when copied from A2 to M2):


IFERROR(OFFSET('PRE-FILL DATA'::$A$1,XMATCH($C2,'PRE-FILL DATA'::$C),XMATCH(M$1,'PRE-FILL DATA'::$1:$1)−1),"")



Compare that to yours in your latest screenshot. You will see immediately that they are not the same. Hint: look within the second XMATCH. What happened to M$1?


To make it easier to compare and to understand what is going on, I recommend that you uncheck 'Use header names as labels' at Numbers > Settings (old name Preferences) in your menu.


Also to remove distractions it can help to click the unneeded optional parameter tokens and delete them (although you can leave them if you wish).


Also, when debugging formulas it can be helpful to click a warning triangle and see what the message says. Sometimes it just says syntax error. Sometimes it gives more specific clues as to what is wrong.


My formula does work. It should take just a minute or two to get it working in your table and fill/copy it into other cells.


SG




May 26, 2023 8:45 PM in response to JohnGross

You can try using OFFSET, like this:





Enter this formula in cell A2 of the CLIENT DATA table:


=IFERROR(OFFSET('PRE-FILL DATA'::$A$1,XMATCH($C2,'PRE-FILL DATA'::$C),XMATCH(A$1,'PRE-FILL DATA'::$1:$1)−1),"")


The select cell A2, command-c to copy, select B2 and command-v to paste, select C2:E2, and command v to paste, and select M2:Z2 and command v to paste. Then in columns A,B,D,E, M through O fill the formula down their respective columns.


Because of the IFERROR The cells in a row will appear blank until you choose a DIFFICULT LEVEL for that row. When you enter a DIFFICULTY LEVEL for a row using the Pop-Up Menu in that row all the other relevant cells in that row will be filled in automatically with the values from the PRE-FILL DATA table.


(Use ; instead of , in the formula if your region uses , as the decimal separator. From the values in your screenshot it appears that you do not need to make that change, though).


SG

Jun 1, 2023 8:41 PM in response to SGIII

Ok, so this is interesting... I copied your formula above for your M2 cell into my M2 Cell and when I copy from there to other cells.... it works perfectly!


Not sure why , but I'm SUPER HAPPY!


The reason that I have cells that have the triangle above is because those cells are based on formulas. If the cells in M:Z have your formulas in them as opposed to being blank, I get the triangles.


I can get around that by creating a "Default" Pop-up choice the has nothing in for M:Z and have the Pop-up start with the Default choice and it's all good.


Would be nice to have a bit of a more elegant solution for the formulas not working if no pop-up selected, but this totally works...


Thank you so much!


May 27, 2023 8:29 AM in response to SGIII

Somewhat easier to follow instructions:


Double-click cell A2 of CLIENT DATA and paste the following into the formula editor and hit return to accept.


IFERROR(OFFSET('PRE-FILL DATA'::$A$1,XMATCH($C2,'PRE-FILL DATA'::$C),XMATCH(A$1,'PRE-FILL DATA'::$1:$1)−1),"")


Fill or copy that right across the table and and then down so it is in all of the cells in the table.


Select the cells in the columns where you don't want the formula (where you won't be filling in data from PRE-FILL DATA) and hit the delete key.


SG


May 27, 2023 1:39 PM in response to SGIII

Hmmm... That doesn't work for me. Could it be because I have a number of hidden columns in there? It also seems weird that I should copy this formula into the C column, which is what I want to be the Pop-up menu to refer to the PRE-FILL DATA, Column C above.


My goal is to use the PRE-FILL DATA table to set up "templates' for values to be replicated into the CLIENT DATA table.


May 27, 2023 5:55 PM in response to JohnGross

JohnGross wrote:

My goal is to use the PRE-FILL DATA table to set up "templates' for values to be replicated into the CLIENT DATA table.


That's what it does. Choose a DIFFICULTY LEVEL from the Pop-Up Menu in a row in CLIENT DATA and the other cells in that row are filled automatically from the CLIENT DATA table.


Where I wrote C2:E2 I should have writing D2:E2, because the Pop-Up Menu cells are in column C.


I've found it easiest when setting up the CLIENT DATA table to just fill-copy the formula from A2 across and down the entire table, then select the places I don't want it and hit delete. But you can do it the other way too, as I first described.


Either way, it should take only a minute or two to set up the table and get it working, as the formula is written so you can copy it right and down, or down and right.


SG

May 31, 2023 4:48 PM in response to JohnGross

Could the fact that it is not working for me have anything to do with my hidden columns? I wouldn't think so, but I would love to be able to get this to work!


And for what it's worth (if anything) I don't want to replace anything in Column A... I just want the blue columns in PRE-FILL DATA table to feed their values into the corresponding yellow columns in CLIENT DATA table.


I have tried just copying the formula into the columns I want to update, but also followed your instructions exactly and, either way, I get absolutely no data being fed into any cells in CLIENT DATA when selecting a pop-up.

Need help with a custom formula(s)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.