<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Add a new column with a function similar to vlookup in Excel in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694337#M87946</link>
    <description>&lt;P&gt;I'm trying to figure out how to add a new column to a table that will populate with data dependent on other data in that row. We have several fermentations in a data frame. Each one has a blank value. I'd like to have the blank value from each fermentation in a new column so that I can subtract it from the treatment value. Also if there's a better way to do this than creating a new column that would be great too! Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Made up example data:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Fermentation&lt;/TD&gt;&lt;TD&gt;Treatment&lt;/TD&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;TD&gt;Fermentation Blank Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;98&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;73&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Blank&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;84&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;86&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;Blank&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Fri, 03 Nov 2023 19:03:39 GMT</pubDate>
    <dc:creator>VarianceWalrus9</dc:creator>
    <dc:date>2023-11-03T19:03:39Z</dc:date>
    <item>
      <title>Add a new column with a function similar to vlookup in Excel</title>
      <link>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694337#M87946</link>
      <description>&lt;P&gt;I'm trying to figure out how to add a new column to a table that will populate with data dependent on other data in that row. We have several fermentations in a data frame. Each one has a blank value. I'd like to have the blank value from each fermentation in a new column so that I can subtract it from the treatment value. Also if there's a better way to do this than creating a new column that would be great too! Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Made up example data:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Fermentation&lt;/TD&gt;&lt;TD&gt;Treatment&lt;/TD&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;TD&gt;Fermentation Blank Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;98&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;73&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Blank&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;84&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;86&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;Blank&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 03 Nov 2023 19:03:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694337#M87946</guid>
      <dc:creator>VarianceWalrus9</dc:creator>
      <dc:date>2023-11-03T19:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Add a new column with a function similar to vlookup in Excel</title>
      <link>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694348#M87947</link>
      <description>&lt;P&gt;Is the "Value" when Treatment = Blank always less than the Value when Treatment is not Blank?&amp;nbsp; If so, you can just use the ColMin function, by Treatment.&amp;nbsp; If not, I suppose a somewhat clumsy way to do something similar is first create a column that makes Treatment not equal to Blank = 1 and Treatment = Blank equal to zero, and then use the ColMin By approach.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 19:16:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694348#M87947</guid>
      <dc:creator>dale_lehman</dc:creator>
      <dc:date>2023-11-03T19:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add a new column with a function similar to vlookup in Excel</title>
      <link>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694349#M87948</link>
      <description>&lt;P&gt;Where would you have the value if not in a new column?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one formula how you could add it as a new column&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Sum(If(:Treatment == "Blank", :Value, .), :Fermentation)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Nov 2023 19:16:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694349#M87948</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-11-03T19:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Add a new column with a function similar to vlookup in Excel</title>
      <link>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694364#M87949</link>
      <description>&lt;P&gt;When I try this expression I get an error saying&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expecting numeric column in access or evaluation of 'Col Sum', Col Sum/*###*/IF(:Treatment == "Blank", :Value,.):Fermentation)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column "Value" is numeric continuous, so I'm not sure what part of the expression it doesn't like&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 20:10:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694364#M87949</guid>
      <dc:creator>VarianceWalrus9</dc:creator>
      <dc:date>2023-11-03T20:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Add a new column with a function similar to vlookup in Excel</title>
      <link>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694378#M87952</link>
      <description>&lt;P&gt;Most likely the Value column in your datatable isn't formatted as numeric (most likely a character).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a script with example table that does work. Look at the left side for columns and their modeling types, Value is continuous (you cannot have data type = character, modeling type = continuous in JMP (you could have numeric nominal though which you cannot see directly from the modeling types...).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(6),
	Compress File When Saved(1),
	New Column("Fermentation", Character, "Nominal", Set Values({"A", "A", "A", "B", "B", "B"})),
	New Column("Treatment",
		Character(16),
		"Nominal",
		Set Values({"1", "2", "Blank", "1", "2", "Blank"})
	),
	New Column("Value",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([98, 73, 6, 84, 86, 5])
	),
	New Column("Fermentation Blank Value",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([6, 6, 6, 5, 5, 5])
	)
);

dt &amp;lt;&amp;lt; New Column("Val", Numeric, Continuous, Formula(
	Col Sum(If(:Treatment == "Blank", :Value, .), :Fermentation)
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1699044457469.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/58327iBA3DD45F6D7D73B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1699044457469.png" alt="jthi_0-1699044457469.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 20:49:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694378#M87952</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-11-03T20:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: Add a new column with a function similar to vlookup in Excel</title>
      <link>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694455#M87954</link>
      <description>&lt;P&gt;That should have been by Fermentation, not by Treatment.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2023 00:03:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-a-new-column-with-a-function-similar-to-vlookup-in-Excel/m-p/694455#M87954</guid>
      <dc:creator>dale_lehman</dc:creator>
      <dc:date>2023-11-04T00:03:26Z</dc:date>
    </item>
  </channel>
</rss>

